How to fix C++ error: expected unqualified-id
c++
Solution
There should be no semicolon here:
class WordGame;
...but there should be one at the end of your class definition:
...
private:
string theWord;
}; // <-- Semicolon should be at the end of your class definition
Problem
I'm getting this error on line 6: ``` error: expected unqualified-id before '{' token ``` I can't tell what's wrong. ``` #include <iostream> using namespace std; class WordGame; { // <== error is here on line 6 public: void setWord( string word ) { theWord = word; } string getWord() { return theWord; } void displayWord() { cout << "Your word is " << getWord() << endl; } private: string theWord; } int main() { string aWord; WordGame theGame; cin >> aWord; theGame.setWord(aWord); theGame.displaymessage(); } ```