fatal error LNK1104: cannot open file 'LIBC.lib'

I'm trying to compile a C source code project with Visual Studio 2005.  I'm linking in 2 libraries that were built using Visual Studio 2003.  When I build my project, I get 1 error:
fatal error LNK1104: cannot open file 'LIBC.lib'

I know libc.lib is not included with Visual Studio 2005.  How can I overcome this problem

Thanks,
Mike


Answer this question

fatal error LNK1104: cannot open file 'LIBC.lib'

  • Ting-fang Zheng

    Hello thanks for your anwser,

    I will try to get the library sources and compile it in my EXE project, because I have the delivery constraint that there is only one .exe file.

    I will also try to make a static library.

    I was trying to migrate totally on Visual 2005, it is still impossible, and for developers that only got Visual 2005, it seem hard...

    Are you planning to have any improvment on this subject, in a patch or something I always says that Microsoft is very good for retrocompatibility features so I am thinking that this is an issue for you, isn't it

    Wish you a happy new year !


  • Raul Mendoza

    Have you tried Sheng Jiang solution mentioned in this thread

    Thanks,
    Ayman Shoukry
    VC++ Team


  • Sime24

    Following the idea of Borislav (no need of libc), in the project properties, add "LIBC.lib" to Linker/Input/Ignore Specific Library.

  • Ram-Sree

    This is a little bit disturbing.  How could Microsoft release Visual C++ 2005 that cannot use libraries generated from previous versions of the compiler   Microsoft cannot expect everyone to go back and regenerate the libraries.  Is noone else running into this problem

    -Mike

  • Steve Moores

    You might still have one of your older libs that weren't rebuilt.

    Take a look at http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=75362&SiteID=1 that deals with a similar issue.

    Thanks,
      Ayman Shoukry
      VC++ Team

  • Richo

    I have the same problem. I was testing the new 2005 Visual Studio, and this error with 'LIBC.lib' comes at the end...
    Very sad, I can't use Visual Studio 2005 that seems cool by the way.

  • zaidm

    It is possible!!

    The functions, clib.lib exports are already there, so all you need to do is "fool" the compiler. It only needs a library with the name "libc.lib"

    So here is what I did: I made a static lib with a single function in it

    int donothing() { return 28; }

    :)

    I compiled it in release mode, called it clib.lib and copied it to the lib folder of visual c 8. Everything was A-OK! (there was a warning though but it's a small price to pay considering the benefits)

    Goog luck to all :)



  • cbenesh

    I am not sure what is the best solution in this case. The lib folks are on these forums as well so they might be able to add more details.

    Thanks,
      Ayman Shoukry
      VC++ Team

  • BarryTannenbaum

    That is going to be next to impossible.  This is a 3rd party library that was bought many moons ago.  I said the library was created with Visual Studio 2003 but that was not correct.  I'm not sure what version of VC++ was used to create the library.  We were able to link the library with our driver as of Visual Studio 2003.  If I specify the linker command you suggested, I get other unresolved symbols.

    Thanks,
    Mike Anderson

  • Kolchak

    move your old code that calls the old libs into a DLL, compile it w/ VS2003 and start your new code in a new module, compile it w/VS2005...

  • Demono

    The official way of doing that is actually to try to contact the lib owners and ask for a rebuild.

    That is because even if you succeed in linking, you might be mixing CRT models which is not a supported scenario.

    I am not sure if that would work or not, try adding /nodefaultlib:libc.lib to your linker command.

    Thanks,
      Ayman Shoukry
      VC++ Team

  • gandor

    The problem is that I can't rebuild the older lib.  I don't have the source code for it, all I have is the .lib file.  I have my C file which is a driver for the .lib.

    -Mike

  • Karl Sumwalt

    I'm dealing with exactly the same issue. My program links with six libraries, three of which appear to have been built with VC5. (And for these, "-defaultlib:LIBC" shows up when I run "strings foo.lib | grep LIBC".)

    I have the source code for one of these libraries. I rebuilt it, and it went from being 572KB to just over 204MB. (huoh!)

    I don't have the source for at least one of the other libraries. It looks like I'm going to have to either rewrite my app to replace that library -- or keep using VS 2003, which works great.

    But VS 2003 is becoming hard to find. For the record, I have tested my app with the Intel compiler, and it works extremely well. So maybe the long term option is to switch to VS just as an IDE, and use ICL to do all the work.


  • David Sceppa

    I downloaded and installed the Visual C++ 2003 Toolkit and it included libc.lib. Then I followed the instructions for including the Platform SDK found at http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/ and of course changing the path to the toolkit paths. It worked great except for tons of linker warnings about not finding libc.pdb
  • fatal error LNK1104: cannot open file 'LIBC.lib'