调试版本和发布版本是什么意思,区别和用途

2021-12-28 00:00:00 debugging release build wxwidgets c++

可能的重复:
调试/发布差异

我想知道这两个是什么意思:Debug build 和 Release build 以及两者有什么区别.

I want to know what do these two mean: Debug build and Release build and what is the difference between both.

我应该使用哪一个(我的意思是每个人的合适条件)如果我在 Visual Studio 中创建一个简单的 C++ 项目,我现在正在使用哪个版本.[如果我不更改任何项目设置]

Which one should I use (I mean which are the suitable conditions for each one) and which build actually I am using now if I make a simple C++ project in Visual studio. [If I do not change any projects settings]

我问这个是因为我试图使用 wxWidgets 2.9.4 制作一个 GUI,他们给出了添加所需 .lib 的不同情况.这些是

I am asking this because I am trying to make a GUI using wxWidgets 2.9.4 and they give different case of adding required .lib. these are

发布ANSI静态

调试ANSI静态

发布Unicode静态

调试Unicode静态

请给出详细的答案.

推荐答案

调试构建和发布构建只是名称.它们没有任何意义.

Debug build and release build are just names. They don't mean anything.

根据您的应用程序,您可以构建一个、两个或多个不同的方式,使用不同的编译器和链接器组合选项.大多数应用程序应该只构建在一个版本中:您测试和调试客户使用的完全相同的程序.在在某些情况下,使用两种不同的构建可能更实用:总体而言,出于性能原因,客户端代码需要优化,但是调试时你不想优化.然后有案例完全调试(即迭代器验证等)可能导致代码即使对于算法调试也太慢了,所以你会有一个构建有完整的调试检查,没有优化,但没有迭代器调试,一个优化.

Depending on your application, you may build it in one, two or more different ways, using different combinations of compiler and linker options. Most applications should only be build in a single version: you test and debug exactly the same program that the clients use. In some cases, it may be more practical to use two different builds: overall, client code needs optimization, for performance reasons, but you don't want optimization when debugging. And then there are cases where full debugging (i.e. iterator validation, etc.) may result in code that is too slow even for algorithm debugging, so you'll have a build with full debugging checks, one with no optimization, but no iterator debugging, and one with optimization.

每当您开始使用应用程序时,您都必须决定您的选择需要,并创建相应的构建.你可以随便叫他们你想要.

Anytime you start on an application, you have to decide what options you need, and create the corresponding builds. You can call them whatever you want.

关于外部库(如 wxwidgets):所有编译器都有使用不同选项时的一些不兼容性.所以那些交付库(源形式除外)必须提供几个不同的版本,取决于许多问题:

With regards to external libraries (like wxwidgets): all compilers have some incompatibilities when different options are used. So people who deliver libraries (other than in source form) have to provide several different versions, depending on a number of issues:

  • 发布与调试:发布版本将使用一组或多或少的标准优化选项(没有迭代器调试);没有优化的调试版本,带迭代器调试.迭代器调试是否存在是一回事这通常会破坏二进制兼容性.图书馆供应商应该记录哪些选项与每个版本兼容.

  • release vs. debug: the release version will have been compiled with a set of more or less standard optimization options (and no iterator debugging); the debug version without optimization, and with iterator debugging. Whether iterator debugging is present or not is one thing which typically breaks binary compatibility. The library vendor should document which options are compatible with each version.

ANSI 与 Unicode:这可能意味着窄 char 与宽 wchar_t用于字符数据.使用与您使用的内容相对应的任何一个你的申请.(注意这两个区别很大不仅仅是一些编译器开关.你经常需要从根本上不同的代码,并且在所有情况下都正确处理 Unicode 远非不重要的;真正支持 Unicode 的应用程序必须知道诸如组合字符或双向书写之类的东西.)

ANSI vs. Unicode: this probably means narrow char vs wide wchar_t for character data. Use which ever one corresponds to what you use in your application. (Note that the difference between these two is much more than just some compiler switches. You often need radically different code, and handling Unicode correctly in all cases is far from trivial; an application which truly supports Unicode must be aware of things like composing characters or bidirectional writing.)

静态与动态:这决定了库的链接方式和加载.通常,你会想要静态的,至少如果你指望部署您的应用程序在其他机器上而不是在您开发它的机器上.但这也取决于许可问题:如果您需要为每个部署库的机器,使用它可能更有意义动态.

static vs. dynamic: this determines how the library is linked and loaded. Usually, you'll want static, at least if you count on deploying your application on other machines than the one you develop it on. But this also depends on licensing issues: if you need a license for each machine where the library is deployed, it might make more sense to use dynamic.

相关文章