IDE error messages list explained

Hello everybody,

Is there a list of IDE compiler error messages available? As a beginner in C++ I need more than

" expected unqualified-id before 'if' "

as an error message for the line

" if ( digitalRead (A3) == false) "

Thanks in advance,
Dan

This particular error message indicates there is some error in your code before that line.

Thank you pert!

As a beginner in C++

You'll probably generate a significant portion of the error messages in nothing flat.

If pert's comment wasn't sufficient, post ALL of your code and the EXACT error message, including file name, line number, and column number, and we'll laugh at your code. No, wait, I mean help you sort out the problem.

" expected unqualified-id before 'if' "

punctuation error

missing a ;, or a ; where it is not needed

a ( without a matching )
a [ without a matching ]
a { without a matching }

so, that's one...

Common compiler errors caused by mismatched brackets:

"does not name a type" or
"expected declaration before" or
"expected unqualified-id before" or
"expected initializer before"
Usually means you forgot a '{' or put in an extra '}' in the previous function. Since all of the open brackets have been closed, the compiler is looking for further global declarations (variables or functions). If it finds something that looks like executable code instead of a global declaration it emits an error. Make sure that the brackets in the preceding function are in matching pairs '{' followed by '}'.

"a function-definition is not allowed here before '{' token"
(can cause: "'functionName' was not declared in this scope")
Usually means you forgot a '}' or put in an extra '{' in the previous function. Since a set of brackets has not been closed yet the compiler is looking for more code to put in the function. You can't declare a function inside a function so if the compiler finds a function declaration it emits an error. Make sure that the brackets in the preceding function are in matching pairs '{' followed by '}'.

"expected '}' at end of input"
Usually means you forgot a '}' or put in an extra '{' in the last function in the sketch. Since a set of brackets has not been closed yet, the compiler is looking for more code to put in the function. When it hits the end of the file instead, it emits an error. Make sure that the brackets in the last function are in matching pairs '{' followed by '}'.

"expected primary-expression before '}' token"
Usually means you have an incomplete statement before a '}'. The block statement (between '{' and matching '}') can only contain complete statements. Complete statements always end with ';' (or '}' for a block statement).

It's important to know that error messages tend to cascade, caused by the original error. Until you know what you're doing, and likely even then, it's usually best to fix the first error and recompile. Oftentimes, a bunch of errors will evaporate.

And take pert's pertinent comment to heart: the line the error is reported on is just the point at which the compiler noticed something wrong, the real issue could easily be in the line(s) above.

wildbill is mostly right, but I have had the compiler tell me there is an error in line 5 when line 5 has worked for months

the error is most likely in the last line you changed, or a line you changed since you saved. this is why you save a version with the current time in the filename every 5 minutes, and put a flag character like ^ in the file name if it compiles. so you have a way to find the most recent fallback. do not change a fourth of the code, then try to compile

^ works in Linux filenames

Or you could simple use a version control. Git has a GUI for windows too.