c++ if (调试) ..."=="标记之前的预期主表达式
c++ if (DEBUG) ... expected primary-expression before '==' token
#define DEBUG 1
void senddata() {
...
if (DEBUG==1) {
cout << row->Printable () << endl;
};
....
}
getrow.cc:在函数 'void senddata()' 中:getrow.cc:277:错误:"=="标记之前的预期主表达式
IMO 代码几天前正在运行... - 知道这里出了什么问题吗?
我根本不会那样做。这似乎更合适:
#ifdef DEBUG
cout << row->Printable() << endl;
#endif
如果您做错了什么(例如在某处忘记了分号),这也会产生更好的警告和错误。
相关文章:
- 优化/减少 if 语句中的条件表达式
- 代码样式:在 switch/if 语句的分支中重用控件表达式或控制变量
- if 语句中的复合表达式
- 如何将特征张量的值作为'if'条件表达式
- 重构模板函数中的常量表达式 if 语句
- 在 if 语句中返回布尔值的 lambda 表达式
- 布尔表达式是否像使用 if 或 switch 进行分支一样繁琐?
- 为什么我不能在我的三元表达式中使用 return,但我可以在常规的 if-else 语句中使用?
- IF-ELSE语句的Lambda表达式的返回类型扣除
- 'if'之前的主要表达式出现错误
- 为什么 if constexpr 不会使这个核心常量表达式错误消失?
- 带有 or 表达式的 If 语句中的语法错误
- "if"表达式的评估
- C++Bare布尔表达式(不包含if、while或其他语句)
- 求和1~N,不使用乘法、除法、if、while、for、switch和三元表达式
- 在令牌和'else'之前'%'预期的主表达式,没有以前的'if'
- 表达式跟进中的变量声明'if'
- if语句中的函数:期望的错误表达式
- 如何优化If/then条件表达式的长序列- SIMD
- 是否有一种方法可以在IF中编写lambda表达式并捕获所有内容