Advertisement

'using namespace std' problems

Started by April 24, 2001 07:35 PM
1 comment, last by anthr4x- 23 years, 9 months ago
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?
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 );
Advertisement
Or just move the ''using'' in to the implementation files
Chris Brodie

This topic is closed to new replies.

Advertisement