Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
哪些预处理器定义可以让您识别 VxWorks 中项目的构建版本?我正在寻找 VC++ 中使用的 _DEBUG(调试模式)/_NDEBUG(发布模式)行。
#ifdef _DEBUG string strBuildMode = "Debug"; #else string strBuildMode = "Release"; #endif
标准宏(VC++ 也支持)是NDEBUG. 它有消极的逻辑:它是在发布版本中定义的。记录的功能是关闭assert()(从<cassert>)关闭。
NDEBUG
assert()
<cassert>
您可以在调试模式的构建属性的“工具标志”选项中添加开关 -DDEBUG(以及 -g 选项)。然后可以在程序中使用该宏来识别构建模式。