Expected constructor, destructor, or type conversion before ‘namespace’

From Cppsyntax

Jump to: navigation, search

One way that you can get the message

  expected constructor, destructor, or type conversion before ‘namespace’

is if you have a typo in the word "using":


RIGHT

 #include <iostream>   
 use namespace std;   // "using" is correct, not "use"
 int main(void) 
 {
   cout << "A";
   return 0;
 }

RIGHT

 #include <iostream>   
 using namespace std;   // that's better!
 int main(void) 
 {
   cout << "A";
   return 0;
 }
Personal tools