[英]c++ if (DEBUG) … expected primary-expression before '==' token
#define DEBUG 1
void senddata() {
...
if (DEBUG==1) {
cout << row->Printable () << endl;
};
....
}
getrow.cc: In function 'void senddata()': getrow.cc:277: error: expected primary-expression before '==' token getrow.cc:在函数'void senddata()'中:getrow.cc:277:错误:在'=='标记之前的预期主表达式
IMO that code was running some days ago... - Any idea what's wrong here? IMO几天前代码正在运行...-知道这里出了什么问题吗?
I wouldn't do it like that at all. 我根本不会那样做。 This seems more appropriate:
这似乎更合适:
#ifdef DEBUG
cout << row->Printable() << endl;
#endif
This also generates better warnings and errors if you are doing something wrong (like forgot a semicolon somewhere). 如果您做错了事情(例如忘记某处的分号),这也会生成更好的警告和错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.