meselfs

Hello,

I have some C code that I downloaded from some website, and I'm trying to compile it with MSVC 2005. There are 91 static libraries (*.lib) associated with this project that I built with a freeware C compiler called PellesC, because that compiler gave far fewer errors. These libs are PE/COFF. In the MSVC project settings, I made sure to use the option for making C (opposed to C++), also the multi-threaded library is used (/Mt). After some minor syntax fixups, it compiles without problem, except for this linking error:

LINK : fatal error LNK1104: cannot open file 'crt.lib'

Nothing asks for crt.lib to be included. One thing I've noticed: calling or using something externally defined will give this error, if such calls/accesses are commented out, succesful build.

Code is not top secret, so I can share (5 mb) if necessary.

Any ideas Thanks!


Re: Visual C++ General MSVC wants crt.lib?

Sarath.

You may have to replace it with msvcrt.lib (or msvcrt8.lib)





Re: Visual C++ General MSVC wants crt.lib?

crescens2k

The CRT you used to compile the static libraries, does that use crt.lib as it's CRT file This could be because it want the default libraries used to compile these static libraries.




Re: Visual C++ General MSVC wants crt.lib?

Carl Daniel

You're definitely treading on thin ice here - linking modules that weren't compiled with VC++ is not guaranteed to work.

That said, try adding /nodefaultlib to your linker command line. That will suppress all default library requests that are embedded in the modules being linked. You'll then have to explicitly add the CRT library of your choice (probably libcmt.lib, to use the static CRT or msvcrt.lib to use the DLL version of the CRT).






Re: Visual C++ General MSVC wants crt.lib?

meselfs

I thought I may be on thin ice, but the thing is that alot of packages, such as SDL, come with lib files. Surely VC++ would accept those, right

Maybe not. I tried suppressing default libs and got lots of errors, but I didn't try very hard to include things like libcmt. Will try again, thanks!

The CRT you used to compile the static libraries, does that use crt.lib as it's CRT file This could be because it want the default libraries used to compile these static libraries.


Yes, it does. I already toyed with putting crt.lib into the project, didn't seem to work well, but I guess I can try harder.