Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


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: 1129

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: 8515

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