简体   繁体   English

在调试模式下使用boost libs的发行版

[英]using the release version of boost libs in debug mode

I have a visual C++ project. 我有一个可视的C ++项目。 I cannot use the release version of boost_filesystem-vc110-mt-1_54.lib in debug mode and it keeps asking for boost_filesystem-vc110-mt-gd-1_54.lib. 我无法在调试模式下使用boost_filesystem-vc110-mt-1_54.lib的发行版,并且它一直在询问boost_filesystem-vc110-mt-gd-1_54.lib。 I know that debug mode should use debug lib but I dont want to build and keep the debug version. 我知道调试模式应使用debug lib,但我不想构建并保留调试版本。 I did try the Runtime Library Setting. 我确实尝试过运行时库设置。

How to do this? 这个怎么做?

Short answer: You don't. 简短的回答:您没有。 Boost uses parts of the C++ runtime which work differently in Debug and Release so stuff is likely to break eventually. Boost使用的C ++运行时部分在“调试”和“发布”中的工作方式有所不同,因此最终可能会中断

However, if you absolutely want to shoot yourself in the foot: You can prevent automatic linking by setting the BOOST_ALL_NO_LIB preprocessor flag and then manually link to the release binary instead. 但是,如果您绝对想自己动手,可以通过设置BOOST_ALL_NO_LIB预处理器标志,然后手动链接到发行版二进制文件来防止自动链接。

You really, really shouldn't use the release version of Boost in a debug build, because (as ComicSansMS said) it links against the release runtime library, and your debug build links against the debug runtime library. 您确实不应该在调试版本中使用Boost的发行版,因为(如ComicSansMS所说)它与发布运行时库链接,而您的调试版本则与调试运行时库链接。

If you really want the release version of Boost (in the case of Filesystem, I must stress that this is probably not useful), you will have to compile your own, which is optimized but links against the debug runtime. 如果您确实想要Boost的发行版(在Filesystem的情况下,我必须强调这可能没有用),则必须编译自己的程序,该程序已经过优化,但与调试运行时链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM