error C2061: syntax error : identifier 'THIS_FILE'
来源:互联网 发布:js数组中查找指定元素 编辑:程序博客网 时间:2024/04/29 18:05
编译时遇到如下错误:
--------------------Configuration: epupserver - Win32 Debug--------------------
Compiling...
epupserverDlg.cpp
C:/Program Files/Microsoft Visual Studio/VC98/INCLUDE/new(35) : error C2061: syntax error : identifier 'THIS_FILE'
C:/Program Files/Microsoft Visual Studio/VC98/INCLUDE/new(35) : error C2091: function returns function
C:/Program Files/Microsoft Visual Studio/VC98/INCLUDE/new(35) : error C2809: 'operator new' has no formal parameters
C:/Program Files/Microsoft Visual Studio/VC98/INCLUDE/new(36) : error C2061: syntax error : identifier 'THIS_FILE'
C:/Program Files/Microsoft Visual Studio/VC98/INCLUDE/new(37) : error C2091: function returns function
C:/Program Files/Microsoft Visual Studio/VC98/INCLUDE/new(37) : error C2556: 'void *(__cdecl *__cdecl operator new(void))(unsigned int,const struct std::nothrow_t &)' : overloaded function differs only by return type from 'void *(__cdecl *__cdecl op
erator new(void))(unsigned int)'
C:/Program Files/Microsoft Visual Studio/VC98/INCLUDE/new(35) : see declaration of 'new'
Error executing cl.exe.
epupserver.exe - 6 error(s), 0 warning(s)
解决方法:
类中用了STL,而包含STL头文件的时候写的位置如下所示:
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
……………………
#include <iostream>
#include <string>
using namespace std;
上网搜索一遍,发现出现这些错误与STL头文件和VC6在CPP文件里生成的几行代码有关,STL头文件是指以下几行:
#include <iostream>
#include <string>
using namespace std;
VC6在CPP文件里生成的几行代码指以下几行:
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
不知道谁写的代码,将
#include <iostream>
#include <string>
using namespace std;
写在cpp文件快结束的几个函数之前,于是将这几行拖到前面。
#include <iostream>
#include <string>
using namespace std;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
- error C2061: syntax error : identifier 'THIS_FILE'
- error C2061: syntax error : identifier 'THIS_FILE'
- error C2061: syntax error : identifier 'THIS_FILE'
- 【转】编译时遇到如下错误error C2061: syntax error : identifier 'THIS_FILE'
- 编译时遇到如下错误error C2061: syntax error : identifier 'THIS_FILE'
- 编译时遇到如下错误error C2061: syntax error : identifier 'THIS_FILE'
- 编译时遇到如下错误error C2061: syntax error : identifier 'THIS_FILE'
- 编译时遇到如下错误error C2061: syntax error : identifier 'THIS_FILE'
- 编译时遇到如下错误error C2061: syntax error : identifier 'THIS_FILE'
- error C2061: syntax error : identifier 'LONG_PTR'
- error C2061: syntax error : identifier 'CAMSchedule'
- error C2061: syntax error : identifier '__RPC__deref_out_opt
- error C2061: syntax error : identifier ‘XXXX’
- error C2061: syntax error : identifier 'PCONTEXT'处理
- error C2061: syntax error : identifier '__RPC__out_xcount_part'
- error C2061: syntax error : identifier '_Wherenode'
- error C2061: syntax error : identifier 'CAMSchedule'
- error C2061: syntax error : identifier 'string'
- oracle用户权限及角色
- WebService应用
- 中医英语语料库建设可行性探讨
- 获取GridView中某一单元格的值
- 常见的硬盘分区软件
- error C2061: syntax error : identifier 'THIS_FILE'
- vim和gedit时 中文乱码问题
- 基于文本内容理解的中医药数据基础研究——中医药文献语料库的建设
- Windows环境下的Tomcat + Apache配置
- CSharp Tips:使用OleDb操纵Excel文件(1)
- 硬盘整数分区
- settings.xml
- hadoop简介
- ldap 身份验证的通用步骤