一般程序中,第一次写string str;然后就#include <string.h>,自以为对的编译后,发现不通过。其实主要是string.h这个名字把我们迷惑了,在vc.net中搜索string.h,然后打开查看,可以清楚地发现extern "C",其实string.h是一个C的头文件,而不是我们认为的与标准库中的<string>等价的头文件,我们必须使用
#include<string>
using namespace std;
这样才能够使用string这个类。
#include<string>
using namespace std;
这样才能够使用string这个类。