Pelles C forum

C language => Windows questions => Topic started by: rpfister on August 19, 2016, 01:30:53 AM

Title: Visual Studio "cannot open file 'crtmt.lib'" when including lib built in Pelles
Post by: rpfister on August 19, 2016, 01:30:53 AM
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
Title: Re: Visual Studio "cannot open file 'crtmt.lib'" when including lib built in Pelles
Post by: frankie on August 19, 2016, 02:42:24 PM
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.