Strange end to program error

im getting a strange error in my program. my compiler tells me:

expected `}' at end of input expected unqualified-id at end of input expected `,' or `;' at end of input 

and its highlighting the last line of my code, which is the closing bracket for my main () function. I commented all the code in int main (), but it still refuses to compile. I checked for the absence of ";" and there is nothing. SciTE checks the brackets and brackets and stuff, so I know that everything is closed correctly. I don't do crazy at all

will include classes causing these errors?

 #include <iostream> #include <fstream> #include <vector> #include "commands.h" int main(){ } 

if the problem was in .h commands, will it appear in the last bracket?

+6
c ++ compiler-errors
source share
1 answer

You probably forgot the semicolon after the closing curly brace in the class or structure definition.

 class C { } // <<-- HERE, semicolon needed 

One of the other things that may appear is a variable declaration:

 class C { } c; // <<-- creates a global variable of type "class C" 

Since the variable name is an unqualified identifier, this explains your error message.

+11
source share

All Articles