By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,248 Members | 1,961 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,248 IT Pros & Developers. It's quick & easy.

what is an" uniqualifed-id before "{"token message referring to

P: 2
i continually experience an "expected uqualified-id before "{" token. All the answers so far have suggested "work arounds"but don't say what an uqualified-id actually is.

I really don't want an alternative code , but a description of what an unqualified-id actually is
Here is a part of the code
Expand|Select|Wrap|Line Numbers
  1.  #include <iostream>
  2.  #included <string>
  3.  int main()
  4.  
  5. { // here I start the function, but the error message is for line 3.
Jun 18 '19 #1

✓ answered by dev7060

A qualified name refers to a class member, namespace member or enumerator. It appears to the right hand side of the scope resolution operator. It has some sort of indication where it belongs. e.g. cout and endl when used with scope resolution operator (std::cout). 'std' is the name of the namespace that identifier cout is part of.

An unqualified name, on the other hand, doesn't live in any namespace and doesn't need a qualification. e.g. built-in types like int, double etc. You don't use scope resolution operator with them.

According to the part of code you have shown, looks like the pre-processing directive 'include' is misspelled. And hence, compiler couldn't identify that and expects a correct unqualified-id before "{".

Share this Question
Share on Google+
1 Reply


dev7060
P: 77
A qualified name refers to a class member, namespace member or enumerator. It appears to the right hand side of the scope resolution operator. It has some sort of indication where it belongs. e.g. cout and endl when used with scope resolution operator (std::cout). 'std' is the name of the namespace that identifier cout is part of.

An unqualified name, on the other hand, doesn't live in any namespace and doesn't need a qualification. e.g. built-in types like int, double etc. You don't use scope resolution operator with them.

According to the part of code you have shown, looks like the pre-processing directive 'include' is misspelled. And hence, compiler couldn't identify that and expects a correct unqualified-id before "{".
Jun 18 '19 #2

Post your reply

Sign in to post your reply or Sign up for a free account.