Expected qualified-id error in Xcode

I'm getting an error that says "Expected unqualified-id" for line 7. What does this mean?



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>

using namespace std;
int main();


{
    
    string user_name;
    
    cout << "Hello, my name is Hal!\nWhat is your name?\n";
    getline(cin, user_name);
    cout << "Hello " << user_name << ". Nice to meet you! :)";
    
    return 0;
    
}
Very often with error messages of this kind, the actual error is in some previous line. Here line 4 should not have a semicolon, change it to simply int main()
Topic archived. No new replies allowed.