Archived

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

'using namespace std' problems

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