gpt4 book ai didi

c++ - 包括 ZenLib/Ztring.h 在内的字符串常量之前的预期 unqualified-id

转载 作者:太空宇宙 更新时间:2023-11-04 04:00:39 30 4
gpt4 key购买 nike

在包含的 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 应该会有所帮助。

关于c++ - 包括 ZenLib/Ztring.h 在内的字符串常量之前的预期 unqualified-id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12018414/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com