I'm attempting to perform a link of previously generated .obj files (using the latest version of MSVC).
When those .obj's were created, the source code specified:
#pragma comment(lib, ...)
As such, the linker is attempting to link against static libraries specified in the source. Is there a way to instruct the linker to ignore these libraries, so I can specify my own?
e.g., if a piece of source did the following:
#pragma comment(lib, foo.lib)
At link time, I'd like the linker to ignore 'foo.lib', and instead link against 'bar.lib'.
Why not change the source (the
#pragma
directives)?From
comment
MSDN page:You can also use the
NODEFALTLIB
linker option to stopfoo.lib
from being linked, and specifybar.lib
as you would other lib files (i.e. via the Linker Properties pane).Otherwise, rename
bar.lib
tofoo.lib
(a cheeky solution).