主题:一个有关头文件的问题
建了一个工程,主文件名称为MainUnit。建立一个头文件HeadFile.h。把工程中所有的需要的头文件都包含进去。如把MainUnit.cpp的#include "MainUnit.h"替换成#include "HeadFile.h",然后在HeadFile.h中,添上#include "MainUnit.h"。但是编译的时候出现了问题,提示
[C++ Error] sysmac.H(50): E2040 Declaration terminated incorrectly
[C++ Error] sysmac.H(151): E2141 Declaration syntax error
[C++ Error] System.hpp(17): E2141 Declaration syntax error
[C++ Error] dstring.h(17): E2141 Declaration syntax error
[C++ Error] dstring.h(352): E2141 Declaration syntax error
[C++ Error] systobj.h(22): E2141 Declaration syntax error
[C++ Error] systobj.h(417): E2257 , expected
[C++ Error] systobj.h(418): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(419): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(420): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(421): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(422): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(423): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(424): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(425): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(426): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(427): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(428): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(429): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(430): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(431): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(432): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(433): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(434): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(435): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(435): E2228 Too many error or warning messages
这是怎么回事?
我的头文件只有下面几行:
#ifndef HeadFileH
#define HeadFileH
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "Filter.h"
//#include "MainUnit.h"
//所取数据的方式-------------------------------------------------------------
#define GSM_DATA 1001
#define RS232_DATA 1002
#define HISTORY_DATA 1003
#endif
其中如果把#include "MainUnit.h"加上去,就会出现前面所说的错误信息。
[C++ Error] sysmac.H(50): E2040 Declaration terminated incorrectly
[C++ Error] sysmac.H(151): E2141 Declaration syntax error
[C++ Error] System.hpp(17): E2141 Declaration syntax error
[C++ Error] dstring.h(17): E2141 Declaration syntax error
[C++ Error] dstring.h(352): E2141 Declaration syntax error
[C++ Error] systobj.h(22): E2141 Declaration syntax error
[C++ Error] systobj.h(417): E2257 , expected
[C++ Error] systobj.h(418): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(419): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(420): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(421): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(422): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(423): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(424): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(425): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(426): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(427): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(428): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(429): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(430): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(431): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(432): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(433): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(434): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(435): E2040 Declaration terminated incorrectly
[C++ Error] systobj.h(435): E2228 Too many error or warning messages
这是怎么回事?
我的头文件只有下面几行:
#ifndef HeadFileH
#define HeadFileH
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "Filter.h"
//#include "MainUnit.h"
//所取数据的方式-------------------------------------------------------------
#define GSM_DATA 1001
#define RS232_DATA 1002
#define HISTORY_DATA 1003
#endif
其中如果把#include "MainUnit.h"加上去,就会出现前面所说的错误信息。