d:\test\test.cpp(1) : error C2143: syntax error : missing ';' before 'PCH creation point'
我编写了一个头文件,里面是一个结构体和一个简单的类。但是报错如上面信息:
hicc.h
typedef struct note
{
int a ;
struct note * next;
}NOTE;
class Time
{
public:
int hour;
int minute;
int second;
private:
int year;
int month;
int day;
public:
void insertElem();
void outPutElem();
}
在main.cpp里面如下
#include "hicc.h"
void main()
{
Time t;
}
当我在main.cpp里面编译的时候报错,找到原因是只少一个;
在class后面应该有一个;但是他是在cpp文件里面报错的如果单独编译头文件则会出现
![](http://hi.csdn.net/attachment/201109/28/0_1317212048HLjm.gif)
网上的一些帖子指出,头文件不需要编译,他是放在cpp文件里面编译的