visual studio 2010 - Why isn't the "!=" operator working for me in C++ VS2012 -
a simple example:
#include <iostream> #include <cstring> int main(void) { using namespace std; string a="abc"; string b="abc"; if(a!=b) cout<<"abc"; }
this code can compiled mingw g++ ,but can not compiled vs2012 , vs2010. dont know why.
what should make code can compiled vs2012 or vs2010
i found problem headfile why can work in g++?
try change
#include <cstring>
which old, c-style string.h
by
#include <string>
which describe string
class resides in std
namespace in c++.
Comments
Post a Comment