Gururaj

I changed my visual studio version from Microsoft visual studio 6.0 to 8.0
Now getting linker error LINK : fatal error LNK1104: cannot open file 'LIBC.lib' when I build one of the projects of my workspace.
We can fix this from the project settings. You need to add the /NODEFAULTLIB to the linker settings: But it will remove all the default libraries and lead some other problems. So I want to remove only LIBC.lib defualt library from the project settings to avoid this linker error. Can anybody tell me how to do this




Re: Visual C++ Language LINK : fatal error LNK1104: cannot open file 'LIBC.lib'

Bruno van Dooren

Is 'LIBC.lib' still mentioned somewhere in your project linker settings

If that is the case, simply remove it from the linker input list and your problem will go away.

VS does not sort through your linker input when you convert a project to see if that lib file was part of VC6 or not. It just takes all the linker input libs and puts them in your project settings. This can cause the problems you mention.





Re: Visual C++ Language LINK : fatal error LNK1104: cannot open file 'LIBC.lib'

crescens2k

I'm surprised, you found /nodefaultlib but you didn't find ignore specific library since they are right next to each other.

In Project->Properties->Configuration Properties->Linker->Input there are two fileds, Ignore All Default Libraries and Ignore Specific Library. If you put libc.lib into Ignore Specific Library then the linker will not load this library.

What you should do if possible though is to recompile all libraries you are dependent on with VC2005 so they are all using the same version of the CRT.






Re: Visual C++ Language LINK : fatal error LNK1104: cannot open file 'LIBC.lib'

Holger Grund

You can use /NODEFAULTLIB:libc. However, it is a bad idea and unless you really understand the implications you shouldn't do it.

To really solve the problem make sure that all object files contributing to the final image - including the ones in static libraries used in the build - are built with VC++8.0 and the same CRT model. Different versions of the CRT are not compatible and in the vast majority of cases /NODEFAULTLIB only introduces hidden and hard-to-track-down bugs in your code if you eventually get it to link.

If you are uncertain as to where the /DEFAULTLIB:LIBC comes from, you can use /VERBOSE linker switch to tell you. Alternatively, dumpbin /DIRECTIVES will dump these for specific object or library files.

-hg