Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

weird end of program error

im getting a weird error in my program. my compiler is telling 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 have commented out all of the code in int main(), but it still refuses to compile. i checked for missing ";" and theres nothing. SciTE checks parentheses and brackets and stuff, so i know everything is closed properly. i dont seem to be doing anything crazy at all

would including classes cause these errors?

#include <iostream>
#include <fstream>
#include <vector>

#include "commands.h"


int main(){

}

if a problem were in commands.h, would it manifest at the last bracket?

like image 596
calccrypto Avatar asked Nov 10 '10 03:11

calccrypto


1 Answers

You probably forgot the semicolon after the closing brace on a class or structure definition.

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

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

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

Since a variable name is an unqualified-id, this explains your error message.

like image 175
Ben Voigt Avatar answered Oct 08 '22 22:10

Ben Voigt