源码中有如下一段代码
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
编译时出现如下的一堆错误:
d:\program files\microsoft visual studio\vc98\include\new(35) : error C2061: syntax error : identifier 'THIS_FILE'
d:\program files\microsoft visual studio\vc98\include\new(35) : error C2091: function returns function
d:\program files\microsoft visual studio\vc98\include\new(35) : error C2809: 'operator new' has no formal parameters
d:\program files\microsoft visual studio\vc98\include\new(36) : error C2061: syntax error : identifier 'THIS_FILE'
d:\program files\microsoft visual studio\vc98\include\new(37) : error C2091: function returns function
d:\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)'
....
请教怎样解决这样的问题,还有就是前面的那段源代码是什么意思?源码是别人写的.
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
编译时出现如下的一堆错误:
d:\program files\microsoft visual studio\vc98\include\new(35) : error C2061: syntax error : identifier 'THIS_FILE'
d:\program files\microsoft visual studio\vc98\include\new(35) : error C2091: function returns function
d:\program files\microsoft visual studio\vc98\include\new(35) : error C2809: 'operator new' has no formal parameters
d:\program files\microsoft visual studio\vc98\include\new(36) : error C2061: syntax error : identifier 'THIS_FILE'
d:\program files\microsoft visual studio\vc98\include\new(37) : error C2091: function returns function
d:\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)'
....
请教怎样解决这样的问题,还有就是前面的那段源代码是什么意思?源码是别人写的.
解决方案 »
- 请教如何读取文本中的数值数据并保存在数组中
- ShellExecute 新手问题
- 求救数据库和动态链接库
- ||||有分求助::文本框里内容如何实现行的高亮,我要点哪行就哪行并且程序知道现在点的是什么内容!!谢谢
- 为什么WindowProc不执行鼠标单击的消息
- 如何改变AfxMessageBox上按钮的文本
- API拦截问题!菜鸟,高手都请来看看!帮哥们分析分析怎么回事!
- 网上哪里有API函数详解,类似于VC++库函数手册哪样的?
- 请教:怎么杀掉自动生成desktop.ini和folder.htt文件的病毒?谢谢!
- 两个小问题,每个25分
- 如何改变static text 的颜色?
- 怎么样改变Splitter的宽度??
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
好像.cpp文件中最开头都是这样的嘛,自动定义的啊。
你试试把define new那条放到第二行?我看好像都是那样的。
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/* Compile options needed: /c /D_DEBUG /DNOMINMAX
*/ #include <afxwin.h> // or stdafx.h in a default AppWizard project.
//#include <new.h> // Required to avoid this problem. #ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif namespace std {
#include <vector.h>
}
但是还会存在如下的错误
d:\program files\microsoft visual studio\vc98\include\memory(16) : error C2061: syntax error : identifier 'THIS_FILE'
d:\program files\microsoft visual studio\vc98\include\memory(17) : error C2091: function returns function
d:\program files\microsoft visual studio\vc98\include\memory(17) : error C2809: 'operator new' has no formal parameters
d:\program files\microsoft visual studio\vc98\include\memory(20) : error C2954: template definitions cannot nest
是不是还是缺少什么头文件呀??急
我想缺少THIS_FILE的声明定义吧。