编译时添加的奇怪字符会导致错误
Strange character added while compilation, leads to an error
当用Visual Studio Express 2013编译项目时,我得到这个错误
....WDLIPlugIPlugVST3.cpp(199):错误C2065: 'Lp':未声明的标识符[D: WDL -olIPlugExamplesMyFirstPluginMyFirstPlugin-vst3.vcxproj]
奇怪的是文件IPlugVST3.cpp
不包含Lp
而只包含p
:
switch (p->Type())
{
case IParam::kTypeDouble:
case IParam::kTypeInt:
{
Parameter* param = new RangeParameter( STR16(p->GetNameForHost()), // <---- this line
i,
STR16(p->GetLabelForHost()),
p->GetMin(),
p->GetMax(),
p->GetDefault(),
0, // continuous
flags,
unitID);
param->setPrecision (p->GetPrecision());
parameters.addParameter(param);
为什么c++编译器把它理解为Lp
而不是p
?
注意:我检查了是否没有隐藏的unicode字符(这存在吗?)但是没有…
STR16
很可能是一个需要字符串作为参数的宏,例如
#define STR16(s) L##s
或类似的东西。如果你传递一个变量而不是字符串字面值,那么你会得到类似于你正在观察的问题。
相关文章:
- 我的字符计数代码计算错误.为什么
- 错误:字符数组的初始值设定项太多
- 需要帮助在 c++ 中将字符串转换为字符 ----错误 "const char *" 类型的值不能用于初始化 "char" 类型的实体
- 如何解决一元"*"(有"字符")错误的无效类型参数?
- 在函数 strcpy() 中访问字符数组时出现分段错误
- 错误:请求从"常量字符 [5]"转换为非标量类型"字符串"
- 为什么我的代码在尝试复制字符数组时引发 C6386 错误?
- 为什么C++在将浮点数转换为字符时没有显示缩小转换错误?
- C++ 字符错误
- 增量生成 - 错误:字符串的第一个字符应'0'或'1'
- 我如何处理有关输入的字符串大小超过字符数组设置大小的错误?
- C++错误字符分配
- C 字符串对象错误字符
- 奇怪的错误字符加密 (ASCII)
- 将 XOR 加密错误字符转换为 int 会失去精度
- 错误:字符数组的初始化器字符串太长c++
- 文件输出中存在错误字符
- 我使用 POCO 解析 JSON.它抛出一个异常:JSON 异常:错误字符.如何处理汉字
- 返回错误字符的c++数组
- c++凯撒密码程序执行错误字符