• <bdo id='mUecz'></bdo><ul id='mUecz'></ul>
    1. <small id='mUecz'></small><noframes id='mUecz'>

      <tfoot id='mUecz'></tfoot>
      <i id='mUecz'><tr id='mUecz'><dt id='mUecz'><q id='mUecz'><span id='mUecz'><b id='mUecz'><form id='mUecz'><ins id='mUecz'></ins><ul id='mUecz'></ul><sub id='mUecz'></sub></form><legend id='mUecz'></legend><bdo id='mUecz'><pre id='mUecz'><center id='mUecz'></center></pre></bdo></b><th id='mUecz'></th></span></q></dt></tr></i><div id='mUecz'><tfoot id='mUecz'></tfoot><dl id='mUecz'><fieldset id='mUecz'></fieldset></dl></div>
    2. <legend id='mUecz'><style id='mUecz'><dir id='mUecz'><q id='mUecz'></q></dir></style></legend>
    3. 混合调试和发布库/二进制文件 - 不好的做法?

      时间:2023-05-23
    4. <small id='Z503I'></small><noframes id='Z503I'>

          <tbody id='Z503I'></tbody>

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

        • <bdo id='Z503I'></bdo><ul id='Z503I'></ul>
              1. <tfoot id='Z503I'></tfoot>
                本文介绍了混合调试和发布库/二进制文件 - 不好的做法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                在调试二进制文件中使用第 3 方库的发布版本是一种不好的做法吗?

                Is it a bad practice to use a release version of 3rd party library in debug binary?

                我正在使用第 3 方库并编译了一个发行版 .lib 库.我的 exe 处于调试模式开发.然后我得到:

                I am using a 3rd party library and compiled a release .lib library. My exe is in debug mode development. Then I got:

                error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in test1.obj
                

                经过一些谷歌搜索后,我发现这是因为我试图将发布与调试混合在一起,我可能应该在调试模式下编译库,或者以其他方式混淆 _ITERATOR_DEBUG_LEVEL 宏.但我只是好奇这是否是推荐的方式以及为什么.我需要为我打算使用的每个 3rd 方库编译并保留发布和调试二进制文件的记录,这似乎很麻烦,这很快就会很多,而无意调试这些代码.

                After some googling I found that is because I am trying to mix release with debug, and I should probably compile the library in debug mode or otherwise muddle with the _ITERATOR_DEBUG_LEVEL macro. But I am just curious if that is the recommanded way and why. It just seem cumbersome that I need to compile and keep a record of both release and debug binaries for every 3rd party library I intend to use, which will be many very soon, while having no intention to debug into these code.

                推荐答案

                混合调试和发布代码是不好的做法.问题是不同的版本可能依赖于 C++ 运行时库的不同基本部分,例如如何分配内存,诸如迭代器之类的结构可能不同,可能会生成额外的代码来执行操作(例如检查迭代器).

                Mixing debug and release code is bad practice. The problem is that the different versions can depend on different fundamental parts of the C++ runtime library, such as how memory is allocated, structures for things like iterators might be different, extra code could be generated to perform operations (e.g. checked iterators).

                这与使用任何其他不同设置构建的混合库文件相同.想象一个头文件包含应用程序和库都使用的结构的情况.该库是通过将结构打包和对齐设置为一个值而构建的,而应用程序则是用另一个值构建的.无法保证将结构从应用程序传递到库中会起作用,因为它们的大小和成员位置可能不同.

                It's the same as mixing library files built with any other different settings. Imagine a case where a header file contains a structure that is used by both application and library. The library is built with structure packing and alignment set to one value and the application built with another. There are no guarantees that passing the structure from the application into the library will work since they could vary in size and member positions.

                是否可以将您的第 3 方库构建为 DLL?假设任何函数的接口更清晰并且不尝试传递任何 STL 对象,您将能够毫无问题地将调试应用程序与发布 DLL 混合使用.

                Is it possible to build your 3rd party libraries as DLLs? Assuming the interface to any functions is cleaner and does not try to pass any STL objects you will be able to mix a debug application with release DLLs without problems.

                这篇关于混合调试和发布库/二进制文件 - 不好的做法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:一个 VS2010 错误?允许在没有警告的情况下绑定非 下一篇:从不同 VS2010 项目中的 C++ 代码调用 C 函数时出现

                相关文章

                最新文章

              2. <legend id='U5vuZ'><style id='U5vuZ'><dir id='U5vuZ'><q id='U5vuZ'></q></dir></style></legend>

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

                    • <bdo id='U5vuZ'></bdo><ul id='U5vuZ'></ul>

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

                    <tfoot id='U5vuZ'></tfoot>