#ifndef _COMMINI_H
#define _COMMINI_H
#include <string.h>
#include <list.h>
/*其它均注释掉*/
#endif //_COMMINI_H
编译上面这样的头文件,竟然会报错:
d:\vs6\vc98\include\list.h(37) : error C2146: syntax error : missing ';' before identifier 'Length'
d:\vs6\vc98\include\list.h(37) : error C2501: 'DWORD' : missing storage-class or type specifiers
d:\vs6\vc98\include\list.h(37) : error C2501: 'Length' : missing storage-class or type specifiers
d:\vs6\vc98\include\list.h(53) : error C2146: syntax error : missing ';' before identifier 'GetPrevLink'
d:\vs6\vc98\include\list.h(53) : error C2433: 'WINAPI' : 'inline' not permitted on data declarations
d:\vs6\vc98\include\list.h(53) : fatal error C1004: unexpected end of file found
d:\vs6\vc98\include\list.h内容:没有改动过这个标准头文件
...
typedef struct _LINK *LPLINK;
typedef struct _LINK
{
LPLINK PrevLink; //... Previous or back pointer.
LPLINK NextLink; //... Next or forward pointer.
} LINK;
//=============================================================================
// The LIST data structure.
//=============================================================================
typedef struct _LIST
{
LPLINK Tail; //... List Tail pointer.
LPLINK Head; //... List Head pointer.
DWORD Length; //... List Length.-----------------错误定位在这一行
} LIST;
而同一个项目在另一个CommLog.cpp文件里却没有一点错:(list.cpp有很多警告)
#include "CommLog.h"
#include <string.h>
#include <time.h>
#include <sys/timeb.h>
#include <stdio.h>
#include <stdlib.h>
//#include <unistd.h>
#include <stdarg.h>
#include "../mp/Exception.h"
//#define debugLogList
class ClogException: public CException
{
public:
ClogException(int nCode, const char* szMsg);
};
ClogException::ClogException(int nCode, const char* szMsg)
: CException(nCode, szMsg)
{
}
#include <list.h>
typedef list<string> TStrList;
...