C++ error: expected initialiser before 'class'
c++
Solution
The problem is in one of the other headers, one that you #include ahead of `class.h`.
If you show us the top of your main `cpp` file, it might give a clue.
Problem
When I compile the program I am working on I get: expected initializer before 'class' error in my `Class.h` file. I looked up the error message on the internet, but couldn't find the exact error, although similar errors seem to be caused by missing semicolons but I don't see why I need one. This is the code the error points to, I have no other functions or classes before it. ``` class Account { public: double dAccountBalance; double dAccountChange(double dChange); }; ``` In the `Class.cpp` file the `double dAccountChange(double dChange)` function is defined. I don't think this is where the error is coming from but this is the code; ``` double Account::dAccountChange(double dChange) { dAccountBalance += dChange; return 0.0; } ``` When I change the code in Class.h to look like this, ``` ; class Account { public: double dAccountBalance; double dAccountChange(double dChange); }; ``` it doesn't generate an error message, but I can't work out why I need the semicolon before it as the only code I have before it are the following pre-processor lines. ``` #ifndef CLASS_H_INCLUDED #define CLASS_H_INCLUDED ``` Any ideas on why the error is generated?