• Advertisement
Sign in to follow this  

VS 2012 iostream syntax error!

This topic is 1902 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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 {
// ...
}
}

// ...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement