简体   繁体   English

表达式必须是C ++中的整数或无作用域枚举类型?

[英]Expression must be integral or unscoped enum type in C++?

Here is my code: 这是我的代码:

CString fontroute = me32.szExePath + L"Exo-Regular.ttf";

and for some reason Visual Studio 2017 highlights the L and says "Expression must be integral or unscoped enum type" . 出于某种原因,Visual Studio 2017突出显示了L并说"Expression must be integral or unscoped enum type"

me32.szExePath is of type char* . me32.szExePath的类型为char* You cannot add ( + ) a wchar_t -Array ( L"foobar" ) to it. 您不能在其中添加( +wchar_t -Array( L"foobar" )。

Construct a temporary CString from me32.szExePath : me32.szExePath构造一个临时CString

CString fontroute = CString{ me32.szExePath } + L"Exo-Regular.ttf";

and it should work. 它应该工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C++ / 错误:表达式必须具有整数或无作用域的枚举类型 - C++ / Error: expression must have integral or unscoped enum type C++ “表达式必须具有整数或无作用域的枚举类型”错误 - C++ "expression must have integral or unscoped enum type" error C ++-错误C2568-表达式必须具有整数或无作用域的枚举类型 - C++ - Error C2568 - Expression must have an integral or unscoped enum type 表达式必须具有整数或无作用域的枚举类型 - Expression must have integral or unscoped enum type C++ 在方程中使用变量; 错误:表达式必须具有整数或无范围枚举类型及其他 - C++ Using variables in equations; error: expression must have integral or unscoped enum type & others C ++错误:将元素插入到带有operator []的std :: map中时,“表达式必须具有整数或无作用域的枚举类型” - C++ Error: “expression must have integral or unscoped enum type” when inserting element into std::map with operator[] GetBValue错误:表达式必须具有整数或无作用域的枚举类型 - GetBValue Error: Expression must have integral or unscoped enum type 表达式必须具有整数或无范围的枚举类型,并带有字符串向量 - expression must have integral or unscoped enum type, with string vectors 字符串初始化失败:“表达式必须具有整数或无作用域的枚举类型” - String initialization fails: “expression must have integral or unscoped enum type” 表达式必须具有带数组的整数或无作用域枚举类型 - expression must have integral or unscoped enum type with arrays
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM