2

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?

tefd
  • 83
  • 4

2 Answers2

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

Ghassen Hamrouni
  • 3,138
  • 2
  • 20
  • 31
  • The problem here is that it is compiling with libcmdt.lib rather than libcmt.lib - that's where my confusion lies. If I state to ignore libcmt.lib, will libcmtd.lib be linked through a process of elimination? – tefd Dec 06 '10 at 16:29
  • I've since found out that the developer was linking against a debug version of another library (again in the release configuration). Would this be the trigger for pulling in the debug libcmtd? – tefd Dec 06 '10 at 16:31
  • @tefd, you are correct about the debug version of the library pulling in libcmtd. If you can get the release build, the problem should be solved. Otherwise, that's where the ignoring hacks come into play. – pattivacek Jun 19 '14 at 15:27
2

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.

engf-010
  • 3,980
  • 1
  • 14
  • 25