fla*_*shk 4 c c++ widestring c-preprocessor
我有一个字符串宏,如下所示:
#define APPNAME "MyApp"
Run Code Online (Sandbox Code Playgroud)
现在我想通过执行以下操作来构造一个使用此宏的宽字符串:
const wchar_t *AppProgID = APPNAME L".Document";
Run Code Online (Sandbox Code Playgroud)
但是,这会生成"连接不匹配的字符串"编译错误.
有没有办法将APPNAME宏转换为宽字符串文字?
Mar*_*lin 10
你试过了吗
#define APPNAME "MyApp"
#define WIDEN2(x) L ## x
#define WIDEN(x) WIDEN2(x)
const wchar_t *AppProgID = WIDEN(APPNAME) L".Document";
Run Code Online (Sandbox Code Playgroud)