Fix “exit status 1” / “Compilation error: exit status 1”
“exit status 1” only says the compiler failed. The real error is higher up in the output — here’s how to find and read it.
Community draft — report a mistake
What you see
sketch.ino: In function 'void setup()':
sketch.ino:8:3: error: expected ';' before 'pinMode'
8 | pinMode(2, OUTPUT);
| ^~~~~~~
exit status 1
Compilation error: exit status 1sketch.ino: In function 'void setup()':
sketch.ino:8:3: error: expected ';' before 'pinMode'
8 | pinMode(2, OUTPUT);
| ^~~~~~~
exit status 1
Compilation error: exit status 1
“exit status 1” is the last line of a failed compile, not the error itself. The useful message is always above it, with a file name, line number and a short description.
Quick fix — try in order
- 1
Scroll up to the first “error:” line
Enable File → Preferences → “Show verbose output during compile” only if needed; usually the first red “error:” line above “exit status 1” is the real problem.
- 2
Fix the first error first
One mistake (a missing ; or }) can cause dozens of follow-on errors. Fix the first, compile again.
- 3
Check the line before the reported one
“expected ';' before X” usually means the semicolon is missing at the end of the previous line.
- 4
Look up the specific message
Common ones: was not declared in this scope, No such file or directory, does not name a type.
Why it happens
What is exit status 1?
It is the compiler program’s return code meaning “failed”. It contains no detail on its own.
Missing semicolon or brace
The most common cause for beginners. Every statement ends with ; and every { needs a matching }.
Wrong board selected
Code written for ESP32 fails on an Uno board setting (and vice versa) with many errors.
Did this fix it?
Thanks — that helps us keep this page right.