//Parent.h
class Parent
{
public:
Parent(void);
~Parent(void);
private:
string name;
};
//main.cpp
#include
#include
#include "Parent.h"
using namespace std;
void main()
{
system("pause");
}
//Parent.cpp
#include "Parent.h"
Parent::Parent(void)
{
}
Parent::~Parent(void)
{
}
//编译器报错
错误 1 error C2146: 语法错误: 缺少“;”(在标识符“name”的前面) d:\用户目录\我的文档\visual studio 2012\projects\string\string\parent.h 8
错误 2 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int d:\用户目录\我的文档\visual studio 2012\projects\string\string\parent.h 8
错误 3 error C2146: 语法错误: 缺少“;”(在标识符“name”的前面) d:\用户目录\我的文档\visual studio 2012\projects\string\string\parent.h 8
错误 4 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int d:\用户目录\我的文档\visual studio 2012\projects\string\string\parent.h 8
5 IntelliSense: 未定义标识符 "string" d:\用户目录\我的文档\Visual Studio 2012\Projects\string\string\Parent.h 8