我在练习按钮出发的时候出现这么两个错误
#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)
貌似是类型转换错误,但是错误怎么会出现在这个地方了?
谢谢了

解决方案 »

  1.   

    static char THIS_FILE[] = _FILE_;
    ===========
    这是哪来的代码啊?自动生成的?
      

  2.   

    自已加的?
    _FILE_是什么啊?
      

  3.   

    [__FILE__ 是编译器能识别的事先定义的ANSI C 的6个宏之一Quote=引用 3 楼 wltg2001 的回复:]
    引用 2 楼 wangjun198742 的回复:
    自己写添加的引用 1 楼 wltg2001 的回复:
    static char THIS_FILE[] = _FILE_;
    ===========
    这是哪来的代码啊?自动生成的?自已加的?
    _FILE_是什么啊?
    [/Quote]
      

  4.   

    static char THIS_FILE[] = _FILE_;
    你这里定义的是char 数组,那么_FILE_必须是类似于:#define _FILE_   "xxxxx"才行啊
      

  5.   

    _FILE_你没有定义或定义了没有包含头文件,
    静态变量一般为整型
      

  6.   

    __FILE__
    两个下划线,代表当前编译的文件名
      

  7.   

    而且上面报错说:error C2065: '_FILE_' : undeclared identifier
    明显VC没有认出_FILE_来。
      

  8.   


    #ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif是这样的,你写错了把
      

  9.   

    双下划线?但是又出现新的错误
    protected: static struct AFX_MSGMAP const * __stdcall CUsebuttonApp::_GetBaseMessageMap(void)" (?_GetBaseMessageMap@CUsebuttonApp@@KGPBUAFX_MSGMAP@@XZ) already defined in button.obj
    已定义?