# 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.

## 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 on other sites
Maybe you forgot a ';' in the file you include right before iostream.

##### Share on other sites
Indeed I did. Such a weird error message it gave me.

##### Share on other sites
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 { // ... } } // ... 

• 11
• 11
• 9
• 12
• 10