如何为TBB禁用自动链接 [英] How to Disable Auto-link for TBB
问题描述
当我将VS项目构建为Debug时,它总是与tbb_debug.lib自动链接(后者又与tbb_debug.dll链接).有没有一种方法可以覆盖它并使tbb.lib链接甚至用于Debug构建?
When I build my VS project as Debug, it always auto-linked with tbb_debug.lib (which in turn linked with tbb_debug.dll). Is there a way to override this and make tbb.lib linked even for a Debug build?
推荐答案
首先,您确定它是自动链接的"吗?
First, are you sure it is 'auto-linked'?
如果是,则使用#pragma comment( lib, tbb_debug.lib )
完成此操作.查找此代码的位置,如果是您的代码,则对其进行修改,或者以某种方式对其进行废弃处理(通过不包含该代码所在的文件,或者通过#defining禁用此段代码的内容来定义;任何理智的库编写者都应提供这种机制并且应该清楚地记录下来.)
If so, this is done using #pragma comment( lib, tbb_debug.lib )
. Find where this code is, modify it if it's yours, or else disbale it somehow (either by do not including the file where that code is, or by #defining something that disables this piece code; any sane library writer should provide such a mechanism and it should be documented clearly as well).
如果没有这样的编译指示,则将链接库,因为它出现在项目设置中.右键单击项目->属性->链接器->输入并调整.
If there is no such pragma, the library is linked because it appears in the project settings. Right-click project->Properties->Linker->Input and adjust.
编辑,感谢Alexey的评论,您似乎可以禁用TBB的自动链接,如此头文件.定义__TBB_NO_IMPLICIT_LINKAGE
应该可以解决问题.
Edit thanks to Alexey's comment it seems that you can probably disable TBB's autolinking, as seen in this header file. Defining __TBB_NO_IMPLICIT_LINKAGE
should do the trick.
这篇关于如何为TBB禁用自动链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!