原因是头文件的包含顺序不正确,有些头文件是建立在某些在其他的头文件中定义的变量的基础之上的,因此需要将更加基础的头文件放在前面。 下面是网上的一个例子: 今天遇到个编译错误:..\vc98\include\new(35) : error C2061: syntax error : identifier 'THIS_FILE',我的某个.cpp中是这样写的: #include "stdafx.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #include "myUtil.h" 百度了下说是#include顺序问题,要放到'THIS_FILE'定义之前,改成如下即可: #include "stdafx.h" #include "myUtil.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif |
|