VS 2012 iostream syntax error!

Started by
2 comments, last by rip-off 11 years, 5 months ago
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.
Advertisement
Maybe you forgot a ';' in the file you include right before iostream.
Indeed I did. Such a weird error message it gave me.
An invisible text.
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 {
// ...
}
}

// ...

This topic is closed to new replies.

Advertisement