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
VS 2012 iostream syntax error!
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
Popular Topics
Advertisement