在创建.exe项目时,我遇到了一个错误。错误是:编译...
1> KsmXmlXalan.cpp
1>c:\newdir\xalan-c-r786300\inc\xalanc\include\vcppdefinitions.hpp(73): fatal error C1189: #error : NDEBUG must not be defined when _DEBUG is defined.
1> KsmXmlJB.cpp
1> KsmXml.cpp
1>c:\newdir\xalan-c-r786300\inc\xalanc\include\vcppdefinitions.hpp(73): fatal error C1189: #error : NDEBUG must not be defined when _DEBUG is defined.
1> KsmXalan.cpp
1>c:\newdir\xalan-c-r786300\inc\xalanc\include\vcppdefinitions.hpp(73): fatal error C1189: #error : NDEBUG must not be defined when _DEBUG is defined.即使我没有定义_DEBUG (在project->properties->C/C++->Preprocessors->preprocessor定义中),但仍然得到相同的错误。
有人能告诉我为什么它会给出这个错误吗?
提前感谢,致敬,Nagesh
发布于 2011-12-15 04:21:06
当您针对“调试”运行时库进行构建时,_DEBUG始终由预处理器预定义。有关更多信息,请参见MSDN库中的Predefined Macros和Debug Routines。
传统上,NDEBUG是在“发布”构建中定义的(删除assert()调用等),但它不是由预处理器预定义的。
因此,看起来您是在针对调试库进行编译,但也在某个地方定义了NDEBUG。同时定义这两种方法可能是自找麻烦;vcppdefinitions.hpp头文件正在检查这一点并抛出错误。
发布于 2011-12-14 23:15:56
_DEBUG是在这个过程中的某个地方定义的。
不过,您可以做一件简单的事情:
#ifdef _DEBUG
#undef _DEBUG
#define DEBUG_WAS_DEFINED
#endif
#include "vcppdefinitions.hpp"
//....
#ifdef DEBUG_WAS_DEFINED
#undef DEBUG_WAS_DEFINED
#define _DEBUG
#endif该错误通常在将debug与非调试库混合使用时发生。
https://stackoverflow.com/questions/8506714
复制相似问题