我在练习按钮出发的时候出现这么两个错误
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = _FILE_;
:\Documents and Settings\Administrator\桌面\练习\usebutton\NewButton.cpp(8) : error C2065: '_FILE_' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\练习\usebutton\NewButton.cpp(8) : error C2440: 'initializing' : cannot convert from 'int' to 'char []'
There are no conversions to array types, although there are conversions to references or pointers to arrays
Error executing cl.exe.usebutton.exe - 2 error(s), 0 warning(s)
貌似是类型转换错误,但是错误怎么会出现在这个地方了?
谢谢了
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = _FILE_;
:\Documents and Settings\Administrator\桌面\练习\usebutton\NewButton.cpp(8) : error C2065: '_FILE_' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\练习\usebutton\NewButton.cpp(8) : error C2440: 'initializing' : cannot convert from 'int' to 'char []'
There are no conversions to array types, although there are conversions to references or pointers to arrays
Error executing cl.exe.usebutton.exe - 2 error(s), 0 warning(s)
貌似是类型转换错误,但是错误怎么会出现在这个地方了?
谢谢了
===========
这是哪来的代码啊?自动生成的?
_FILE_是什么啊?
引用 2 楼 wangjun198742 的回复:
自己写添加的引用 1 楼 wltg2001 的回复:
static char THIS_FILE[] = _FILE_;
===========
这是哪来的代码啊?自动生成的?自已加的?
_FILE_是什么啊?
[/Quote]
你这里定义的是char 数组,那么_FILE_必须是类似于:#define _FILE_ "xxxxx"才行啊
静态变量一般为整型
两个下划线,代表当前编译的文件名
明显VC没有认出_FILE_来。
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif是这样的,你写错了把
protected: static struct AFX_MSGMAP const * __stdcall CUsebuttonApp::_GetBaseMessageMap(void)" (?_GetBaseMessageMap@CUsebuttonApp@@KGPBUAFX_MSGMAP@@XZ) already defined in button.obj
已定义?