NO

Author Topic: Visual Studio "cannot open file 'crtmt.lib'" when including lib built in Pelles  (Read 3255 times)

rpfister

  • Guest
I am trying to build a project in Visual Studio that depends on a lib I built in Pelles C.  VS throws an error:  "error LNK1104: cannot open file 'crtmt.lib'".  I cannot find anywhere I've specified crtmt.lib, either in the Visual Studio project that uses the Pelles C built lib, or in the Pelles C project that builds the lib, and wonder if it Pelles itself might add a dependency on crtmt.lib.  Does it?  If so, where can I find this lib?  If not, do you have any other ideas what might have caused this dependency?

Thanks,
Bob

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Hello,
as every compiler PellesC use a C runtime library, that in your case is crtmt.lib (C RunTime MultiThreaded lib), which is added to object files as default libraries (MS do the same adding to its objects LIBCMT.lib).
Recompiling your library with the switch 'Omit default library name in object files' set should do the trick (see image).
Now the compiler will omit the reference to the Pelles specific libraries and let the linker use the equivalent functions found in the MS runtime.
« Last Edit: August 19, 2016, 05:15:29 PM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide