Jump to content

  • Log In with Google      Sign In   
  • Create Account


VS 2012 iostream syntax error!


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 lride   Members   -  Reputation: 633

Like
0Likes
Like

Posted 06 November 2012 - 11:04 PM

I was writing some code and I decided to #include <iostream> in my new file.
But all of the sudden I get this error

c:\program files (x86)\microsoft visual studio 11.0\vc\include\iostream(12): error C2143: syntax error : missing ';' before 'namespace'

what happened?!?!?!? I never touched iostream header file
An invisible text.

Sponsor:

#2 bradbobak   Members   -  Reputation: 1024

Like
2Likes
Like

Posted 06 November 2012 - 11:08 PM

Maybe you forgot a ';' in the file you include right before iostream.

#3 lride   Members   -  Reputation: 633

Like
0Likes
Like

Posted 06 November 2012 - 11:14 PM

Indeed I did. Such a weird error message it gave me.
An invisible text.

#4 rip-off   Moderators   -  Reputation: 7706

Like
0Likes
Like

Posted 07 November 2012 - 06:45 AM

The thing to remember here is that the pre-processor handles the includes, and the compiler only sees the pre-processed source file (called a translation unit). Thus, from the compilers point of view you wrote something like this:
class SomeClass {
    // ...
} // <-- whoops

namespace std {
    class iostream {
        // ...
    }
}

// ...





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS