_DEBUG预处理器定义问题

发布时间 2023-12-14 15:53:13作者: Coderrrrrr

release状态编译了一个dll,但运行报assert错误,看了下系统库的源码,是在"#if defined _DEBUG"条件编译下的代码报出来的,疑惑release为什么还有_DEBUG状态,搜了代码、查看了预处理器定义都是没有的。

后询问了大佬,原来如此:

 

 

查看微软官方说明,确实:

The compiler defines _DEBUG when you specify the /MTd or /Mdd option. These options specify debug versions of the C runtime library.  

 

参考链接:https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-6.0/aa246791(v=vs.60)?redirectedfrom=MSDN

 


当您指定/MTd或/Mdd选项时,编译器将定义_DEBUG。这些选项指定C运行时库的调试版本。The results showed that there was no significant difference between the two groups(P> 0.05).

后巽汶

B