Jump to content
  • Advertisement
Sign in to follow this  
mrmrcoleman

C++ Problem, Finally!!

This topic is 5042 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

Hello there, I have a problem with a small program that I am writing. When I #include <iostream> I get hundreds of errors that look a bit like these: Compiling... IntVec.cpp c:\program files\microsoft visual studio\vc98\include\xiosbase(106) : error C2146: syntax error : missing ';' before identifier 'precision' c:\program files\microsoft visual studio\vc98\include\xiosbase(106) : error C2501: 'streamsize' : missing storage-class or type specifiers c:\program files\microsoft visual studio\vc98\include\xiosbase(107) : warning C4183: 'precision': member function definition looks like a ctor, but name does not match enclosing class c:\program files\microsoft visual studio\vc98\include\xiosbase(108) : error C2146: syntax error : missing ';' before identifier 'precision' c:\program files\microsoft visual studio\vc98\include\xiosbase(108) : error C2501: 'streamsize' : missing storage-class or type specifiers Does anybody have any idea what this might be? It seems like the kind of thing that is a simple mistake but I can't work out what it is? Thanks in advance. Mark Coleman

Share this post


Link to post
Share on other sites
Advertisement
wel the first and fourth ones are missing ";" (obviously) dunno about the rest. Maybe you should post the related code so people can help you more.

Share this post


Link to post
Share on other sites
Oh man you have my condolences for your inability to post. Maybe you should try to get that problem fixed before bothering with your C++ :)

You spoke to a staff member about it?

Share this post


Link to post
Share on other sites
Man!! Every time I try to post any large amount of code I get Internal Server Error 500, Bollocks!!

Basically I have a simple app which works fine but as soon as I try to #include <iostream> I get loads of errors??

I can't post the code because it keeps crashing but there are only two files.

The top of the IntVec.cpp file looks like this:

#include <iostream>
#include "IntVec.h"

and the top of the IntVec.h file looks like this:

using namespace std;
#include <iostream>

If I remove the iostream and namespace lines to program works fine, but I need to use the iostream functions.

Any ideas?

Mark Coleman

Share this post


Link to post
Share on other sites
Never put a "using namespace std" directive in a header file. Instead of istream, use std::istream etc.

If the header file already #includes iostream, there is no need to do it in the cpp file, because it propagates.

Share this post


Link to post
Share on other sites
try to compile #include <iostream> without the small program
the errors can be in your small program and not the iostream, so if you still have these errors
then you have a faked iostream..
if they gone, then check out all your ; and }.
i had an error like this in past, i think these errors exists because missing or too many ; / }.

Share this post


Link to post
Share on other sites
Kippesoep, I think I understand, so what would I have in each file?

using namespace std; in the cpp file

and then using std::istream; in the h file??

Mark Coleman

Share this post


Link to post
Share on other sites
What about remove 'using namespace std;' and replace '#include <iostream>' with '#include <iostream.h>'?

Cheers,
ALH

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!