std::string operator != (problems)

Started by
0 comments, last by SiCrane 18 years, 8 months ago
I just recently installed VC++ 2005 Express beta 2. For some reason, the compiler is flagging an error when I try to use the std::string != operator:

std::string a = ...;
if( a != "." && a != ".." ) { ... }
The second line would produce 2 errors (1 from each comparison) that look like this: error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::string' (or there is no acceptable conversion) could be 'built-in C++ operator!=(const char [2], const char [2])' I never got this error in previous versions of VC++. What has changed and how can I fix it?
.:<<-v0d[KA]->>:.
Advertisement
You can get errors like that if you include a std header that has a std::string definition that doesn't actually #include <string>. Now if you have #include <string> in your source file and are still getting those errors, then I have no clue.

This topic is closed to new replies.

Advertisement