Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


'using namespace std' problems

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

ok, in one of my header files, ive declared ''using namespace std;''. Later on in one of me source files, im using a function that returns an ifstream class. When I try to compile, i get error C2872: ''ifstream'': ambiguous symbol. Anyone have any idea how to fix this? I''ve scoured MSDN for any solutions, and have came up with nothing. I practically have that error memorized comments/questions/fixes/flames?

Share this post

Link to post
Share on other sites
Never import the std namespace in header files. Use explicit import.

i.e In header file, do this

void F( std::string &s );

rather than

using namespace std;

void F( string &s );

Share this post

Link to post
Share on other sites

  • 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!