字符串常量(包括ZenLib/Ztring.h)之前应为不合格id



在包含的ZenLib头文件中,我有这个定义配置

//Char types
#if defined(__UNICODE__)
    #if defined (_MSC_VER) && !defined (_NATIVE_WCHAR_T_DEFINED)
        #pragma message Native wchar_t is not defined, not tested, you should put /Zc:wchar_t in compiler options
    #endif
    typedef wchar_t Char;
    #undef  __T
    #define __T(__x) L ## __x
#else // defined(__UNICODE__)
    typedef char Char;
    #undef  __T
    #define __T(__x) __x
#endif // defined(__UNICODE__)
#ifdef wchar_t
    typedef wchar_t wchar;
#endif // wchar_t
//***************************************************************************
// Platform differences
//***************************************************************************
//End of line
extern const Char* EOL;
extern const Char  PathSeparator;

最后两行编译失败,并显示以下消息:

../ZZZ/ZenLib/Conf.h:243: error: expected unqualified-id before string constant
../ZZZ/ZenLib/Conf.h:243: error: expected initializer before string constant
make: *** [mediainfo.o] Error 1

有人能深入了解编译器在这里的期望吗?也标记为c++,因为它是作为cpp文件编译的。

从应用的角度来看,它应该被类型化为char

包含的一个头文件包含EOL的定义,使声明

extern const Char* EOL;

看起来像

extern const Char* 'n'; // or 'r', or a numeric constant

EOL重命名为不同的名称,例如EolEOL_CHAR应该会有所帮助。

最新更新