Visual Studio .NET 2003 - Ignore Specific Library

2019-07-18 15:35发布

问题:

I have a template VS .NET 2003 project, which colleagues copy and customise when developing their software.

It appears the template was altered a while back to set the IgnoreSpecificLibrary property to have libcmt.lib for both release and debug builds (i.e. for both release and debug, the build should ignore libcmt.lib in the linker).

Some projects based on this have since been built, with the release build pulling in libcmtd.lib (evident by looking through the project .map file) which appears to have caused some runtime issues (i.e. a dialog window being flashed up as though a breakpoint had been set).

Does setting IgnoreSpecificLibrary to exclude libcmt.lib automatically make the project link against libcmtd.lib?

What is weird is that building the template (with the incorrect setting) links against libcmt.lib whereas some of the customised projects (though not all) link against libcmtd.lib.

Any ideas?

回答1:

This is what happened:

After compiling the linker takes your object-files and create among others a symbol table ,which has symol-request that have not been fullfilled. Then the linker goes through your list of libraries trying resolve those unfullfilled symbols. Since you ignore libcmt.lib ,your third-party library has left or added some unresolved symbols and it contains a linker request to resolve those from licmtd.lib (and maybe other libs as well) ,since it was compilled with debug option.

If you hadn't ignored libcmt.lib those symbols would most likely be resolved by libcmt.lib and there was no need to pull in stuff from libcmtd.lib (even though it would be looked at to resolve other symbols that were still unfullfilled)

You may try to igmore libcmtd.lib also. If you now get unresolvd externals then it was probebly no a good idea to ignore libcmt.dll.



回答2:

Many projects ignore the libcmt.lib, because it conflicts with the dynamic version msvcrt.lib. Ignoring libcmt in the linker make the project compile with msvcrt.lib