<i id='3npSJ'><tr id='3npSJ'><dt id='3npSJ'><q id='3npSJ'><span id='3npSJ'><b id='3npSJ'><form id='3npSJ'><ins id='3npSJ'></ins><ul id='3npSJ'></ul><sub id='3npSJ'></sub></form><legend id='3npSJ'></legend><bdo id='3npSJ'><pre id='3npSJ'><center id='3npSJ'></center></pre></bdo></b><th id='3npSJ'></th></span></q></dt></tr></i><div id='3npSJ'><tfoot id='3npSJ'></tfoot><dl id='3npSJ'><fieldset id='3npSJ'></fieldset></dl></div>

<legend id='3npSJ'><style id='3npSJ'><dir id='3npSJ'><q id='3npSJ'></q></dir></style></legend>
    • <bdo id='3npSJ'></bdo><ul id='3npSJ'></ul>

    <small id='3npSJ'></small><noframes id='3npSJ'>

        <tfoot id='3npSJ'></tfoot>
      1. 根据 Visual Studio 中的调试/发布配置自动#defines

        Automatic #defines according to Debug/Release config in Visual Studio(根据 Visual Studio 中的调试/发布配置自动#defines)
          • <bdo id='zdMZW'></bdo><ul id='zdMZW'></ul>
              <tbody id='zdMZW'></tbody>

              <small id='zdMZW'></small><noframes id='zdMZW'>

            1. <legend id='zdMZW'><style id='zdMZW'><dir id='zdMZW'><q id='zdMZW'></q></dir></style></legend>
              <i id='zdMZW'><tr id='zdMZW'><dt id='zdMZW'><q id='zdMZW'><span id='zdMZW'><b id='zdMZW'><form id='zdMZW'><ins id='zdMZW'></ins><ul id='zdMZW'></ul><sub id='zdMZW'></sub></form><legend id='zdMZW'></legend><bdo id='zdMZW'><pre id='zdMZW'><center id='zdMZW'></center></pre></bdo></b><th id='zdMZW'></th></span></q></dt></tr></i><div id='zdMZW'><tfoot id='zdMZW'></tfoot><dl id='zdMZW'><fieldset id='zdMZW'></fieldset></dl></div>

                  <tfoot id='zdMZW'></tfoot>
                  本文介绍了根据 Visual Studio 中的调试/发布配置自动#defines的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我的程序中有这样的调试输出:

                  I have debug output in my program like this:

                  #define DEBUG
                  ...
                  #ifdef DEBUG
                      std::cout << "[RE_words] " << m_re << std::endl;
                  #endif
                  

                  DEBUG 是在我的程序中手动定义的.我总是在发布版本时注释掉这一行.在 Visual Studio 中,还有 DebugRelease 版本的配置,用于处理用于编译的命令行等.我还可以使用配置调试"来自动定义 DEBUG 给编译器吗?怎么样?

                  and DEBUG is defined in my program manually. I always comment out the line when I make a release version. In Visual Studio, there are also Configurations for Debug vs Release versions which handle the commandline etc. used for compiling. Can I also use the Configuration "Debug" to automatically define DEBUG to the compiler? How?

                  推荐答案

                  Visual Studio 自动为调试版本定义 _DEBUG 符号(以及用于非调试版本的 NDEBUG).

                  The Visual Studio automatically defines _DEBUG symbol for Debug builds (and NDEBUG for non-debug builds).

                  另一种方法是进入项目设置 -> 配置属性 -> C/C++ -> 预处理器,手动编辑预处理器定义.

                  Another way to do this is to go to the project settings -> configuration properties -> C/C++ -> preprocessor, and edit the preprocessor definitions manually.

                  另见:
                  这个答案更详细地解释了 _DEBUG 和 NDEBUG 之间的区别.
                  这个答案解释了 NDEBUG 符号的用途以及它是否由标准定义.

                  See also:
                  This answer explains the differences between _DEBUG and NDEBUG in more detail.
                  This answer explains the purpose of the NDEBUG symbol and whether or not is it defined by the standard.

                  这篇关于根据 Visual Studio 中的调试/发布配置自动#defines的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Unable to access non-const member functions of objects in C++ std::set(无法访问 C++ std::set 中对象的非常量成员函数)
                  Constructing std::function argument from lambda(从 lambda 构造 std::function 参数)
                  STL BigInt class implementation(STL BigInt 类实现)
                  Sync is unreliable using std::atomic and std::condition_variable(使用 std::atomic 和 std::condition_variable 同步不可靠)
                  Move list element to the end in STL(在 STL 中将列表元素移动到末尾)
                  Why is overloading operatoramp;() prohibited for classes stored in STL containers?(为什么禁止对存储在 STL 容器中的类重载 operatoramp;()?)
                      <tbody id='Xyzxg'></tbody>

                  1. <tfoot id='Xyzxg'></tfoot>
                        • <bdo id='Xyzxg'></bdo><ul id='Xyzxg'></ul>

                          <small id='Xyzxg'></small><noframes id='Xyzxg'>

                            <legend id='Xyzxg'><style id='Xyzxg'><dir id='Xyzxg'><q id='Xyzxg'></q></dir></style></legend>
                          1. <i id='Xyzxg'><tr id='Xyzxg'><dt id='Xyzxg'><q id='Xyzxg'><span id='Xyzxg'><b id='Xyzxg'><form id='Xyzxg'><ins id='Xyzxg'></ins><ul id='Xyzxg'></ul><sub id='Xyzxg'></sub></form><legend id='Xyzxg'></legend><bdo id='Xyzxg'><pre id='Xyzxg'><center id='Xyzxg'></center></pre></bdo></b><th id='Xyzxg'></th></span></q></dt></tr></i><div id='Xyzxg'><tfoot id='Xyzxg'></tfoot><dl id='Xyzxg'><fieldset id='Xyzxg'></fieldset></dl></div>