开发者

How to Disable Auto-link for TBB

When I build my VS project as Debug, it al开发者_开发问答ways 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'?

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.

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.


If the autolinking with tbb_debug.lib is accomplished with:

#pragma comment( lib, "tbb_debug" )

then as explained on the MSDN documentation page for pragma comment:

Places a library-search record in the object file. ... The library name follows the default library-search records in the object file; the linker searches for this library just as if you had named it on the command line provided that the library is not specified with /nodefaultlib.

You could disable the autolinking via #pragma comment( lib, "tbb_debug" ) by passing the linker option /NODEFAULTLIB:tbb_debug.lib.

However, are you asking because you are receiving a "multiply defined symbols" error (LNK1169) or perhaps LNK4098? If so, it may be that you have tbb.lib listed as input to linker for both Debug and Release profiles. You should remove this entry for the Debug profile as the correct library is being automatically linked in.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜