中国开发网: 论坛: 程序员情感CBD: 贴子 67006
haitao
C++/VS的老手过滤看一看:编译上面这样的头文件,竟然会报错
#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;

...
我的blog:http://szhaitao.blog.hexun.com & http://www.hoolee.com/user/haitao
--以上均为泛泛之谈--
不尽牛人滚滚来,无边硬伤纷纷现 人在江湖(出来的),哪能不挨刀(总归是要的)
网络对话,歧义纷生;你以为明白了对方的话,其实呢?

您所在的IP暂时不能使用低版本的QQ,请到:http://im.qq.com/下载安装最新版的QQ,感谢您对QQ的支持和使用

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录