STL, iostream.h
Hello guys, I have a problem, I was wondering if anyone can help.
In my code I use STL and a scripting library. The library header files have lots of #include and overload << operator to perform output. The problem is that whenever there is a line:
ostream& operator<<(ostream&,const sometype &s);
in the library, MSVC++ 6.0 complain about ostream being ambiguous, my question is "is there anyway I can use STL and ostream from iostream.h peacefully?" Since the library I am using is not my own, so I can''t possibly change it to use STL instead.
Thanks a lot.
Well, my first instinct is that you shouldn''t be using #include <iostream.h>, you should be using #include <iostream>. These are subtly different in that the .h prefix is for the ''old'' streams and removing the .h is for the new streams, which are more compatible with the STL. This might solve your problem.
Kylotan''s 100% correct. Be sure when you switch over (and you should--nobody should be using the .h versions of the stream libraries) that you are aware that everything will now be in namespace std. This means you''ll either have to put std:: before the types and names you expect to have (i.e. ostream, cout), or you''ll have to put "using namespace std" somewhere.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement