error C2065: 'string' : undeclared identifier

解决方案 »

  1.   

    #include<string>std::string 
      

  2.   

    #include <string>
    using namespace std;
      

  3.   

    using namespace std;也可以
      

  4.   

    嗯,可以用了。
    如果不加
    #include <string>
    using namespace std;
    直接打两个分号::    然后跳出一个菜单,里面有string,因此我以为string应该是 a member of '`global namespace''     但是为什么出错 string' : is not a member of '`global namespace''
    注意是在MFC下的。
      

  5.   

    #include<string>
    std::string str = "hello";
    我感觉最好还是不要用using namespace std;这样不太好,可能影响到其它地方,尤其是在头文件中