Here is the list of the most common C++ errors we have seen students experience in Mimir Classroom. The list of errors will continue to grow as we learn from students' work and as we hear from instructors like you send recommendations.
Id returned 1 exit status
This typically means that you have variables not defined and the most common cause are typos and spelling mistakes. Check for spelling differences.
template argument 1 is invalid
This typically happens when using templates if the argument is invalid or does not refer to a type. Also check for matching opening and closing < > characters.
‘[variable]’ was not declared in this scope
This typically is an indicator that a variable is called where it doesn't exist. Make sure your variables are declared before you use them and in the correct scope (outside of a function if it's used in multiple functions, for example)
expected ‘}’ at end of input
This typically means that your code is missing a closing '}'. For every opening '{' there should be a closing '}'
expected primary-expression before ‘)’ token
Sometimes this happens when the variable passed into a function isn't the type the function expected. Make sure variables are defined in the correct scope and that the types match the definition.
You can read about function parameters and definitions here: http://www.cplusplus.com/doc/tutorial/functions/
expected primary-expression before ‘}’ token
This can happen due to several issues. Start by checking for matching opening and closing curly brackets '{' and '}'. Remember that for every opening curly bracket '{' there should be a closing curly bracket '}'
‘cout’ was not declared in this scope
Typically this means that the library that contains 'cout' isn't present in your code.
You can read about 'cout' declarations here: http://www.cplusplus.com/reference/iostream/cout/
expected ‘;’ before ‘}’ token
This typically means that there is statement missing a semicolon ';'. The dreaded semicolon, it won't be your last.
You can read about statements in C++ here: http://www.cplusplus.com/doc/tutorial/control/
a function-definition is not allowed here before ‘{’ token
This could happen in several scenarios, you could be missing a closing '}' or it could be occurring due to nested function declarations. Start by checking for matching opening and closing curly brackets.
You can read about function declarations here: https://www.tutorialspoint.com/cplusplus/cpp_functions.htm
conflicting declaration of C function ‘int main(int, char**)’
This error is extensive, the first step would be to make sure that the main() function isn't declared anywhere else.
You can read about the main() function here: https://en.cppreference.com/w/cpp/language/main_function
‘else’ without a previous ‘if’
Start by checking for proper 'if-else' statement syntax.
You can read more about 'if' statements here: http://www.cplusplus.com/doc/tutorial/control/
‘string’ was not declared in this scope
This could happen in a few scenarios but you can start by checking you have the appropriate libraries included. You can read more about libraries that include "string" here: http://www.cplusplus.com/doc/tutorial/namespaces/
We will continue to add C plus plus (C++) errors as they're generated by students' code.