#如果DEBUG总是如此的调试和发布模式模式、DEBUG

2023-09-04 23:15:30 作者:旧人不覆°

由于某些原因,任何code这样的:

For some reason, Any code like:

#if DEBUG
    CallSomeMethod();
#endif

始终是真实的,无论调试或发布模式。任何想法,为什么,什么设置,我可以用它来打开该功能开启或关闭?对于该项目,定义DEBUG常数设置为true。

Is always true regardless of debug or release mode. Any ideas why, and what setting I can use to turn the feature on or off? For the project, define DEBUG constant is set to true.

感谢。

推荐答案

您应该可以在您的项目属性中选择释放模式。用鼠标右键单击您的项目,选择属性,点击窗口左侧的Build选项卡。从那里,你可以取消选中定义DEBUG常数复选框。确保你做到这一点的发布版本,而不是调试模式。

You should be able to select the release mode in your project properties. Right click your project, select Properties and click the build tab on the left of the window. From there, you can uncheck the "define DEBUG constant" box. Make sure you do this for the release build, and not the debug mode.