【发布时间】:2012-01-27 14:24:36
【问题描述】:
我对 Linux C++ 上的 _DEBUG 宏有疑问。 我尝试使用这样的东西:
#ifdef _DEBUG
cout << "Debug!" << endl;
#endif
但是当我在 IDE 中选择调试时它不起作用。但是它适用于Windows。 我在 Linux 上使用 Eclipse IDE 进行 C++ 编码。
【问题讨论】:
-
您必须进入项目属性并查看 Eclipse 为发布和调试变体中的预处理器标志设置了什么。也许自己添加_DEBUG。
-
你在windows中使用过eclipse吗?
-
添加通常的习惯,至少用
<assert.h>和标准的assert宏,是在你不想调试时定义NDEBUG -
@L7ColWinters,我没有。
标签: c++ linux debugging eclipse-cdt