none
LNK1104: cannot open file libc.lib

    Question

  • I have a project built well with VC++ 6.0. The project is built with mutlti-threaded DLL and the project depends on 4 specific libraries and serveral rouge wave libraries.

    Now I try to build it with VS2005 and get the linking error "cannot open file libc.lib". It seems our specific libraries is built with single-threaded DLL, I am not sure, but that is what I want to find out.
    I used /VERBOSE to display the progress message, but couldn't find out which library depends on libc.lib.
    I added libc.lib into ignore specific library and got the 127 linking errors which are related to rouge wave libraries. The following are some errors:

    tls77-ms.lib(rec.obj) : error LNK2001: unresolved external symbol __imp_?_Xran@std@@YAXXZ
    tls77-ms.lib(cstring.obj) : error LNK2019: unresolved external symbol "class std::basic_istream<char,struct std::char_traits<char> > & __cdecl std::operator>>(class std::basic_istream<char,struct std::char_traits<char> > &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (??5std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z) referenced in function "public: class std::basic_istream<char,struct std::char_traits<char> > & __thiscall RWCString::readToken(class std::basic_istream<char,struct std::char_traits<char> > &)" (?readToken@RWCString@@QAEAAV?$basic_istream@DU?$char_traits@D@std@@@std@@AAV23@@Z)

    If I dont' ignore libc.lib, I always get one linking error "cannot open file libc.lib".
    I also tried to use command "link /dump /directives xxx.lib" to check if any library forces to link libc.lib, but it seems all specific libraries are good.

    Does anyone have any idea to locate this issue?
    Thanks in advance!
    Friday, August 19, 2005 6:35 PM

Answers

  • What I meant is the build log html file where the compiler and linker switches are specified.

    Thanks,
      Ayman Shoukry
      VC++ Team
    Friday, August 19, 2005 8:25 PM
    Moderator

All replies

  • Can you look at the build log and see if the project is specifically trying to link with libc.lib?

    Thanks,
      Ayman Shoukry
      VC++ Team
    Friday, August 19, 2005 7:40 PM
    Moderator
  • Here it is: (I also got a lot of warning LNK4224 as the following, I only copy one of them)
    Compiling...
    testApp.c
    sharemem.c
    Generating Code...
    Compiling resources...
    Compiling manifest to resources...
    Linking...
    tls77-ms.lib(tlslocale.obj) : warning LNK4224: /COMMENT is no longer supported;  ignored
    LINK : fatal error LNK1104: cannot open file 'libc.lib'
    Creating browse information file...
    Microsoft Browse Information Maintenance Utility Version 8.00.50215
    Copyright (C) Microsoft Corporation. All rights reserved.

    Friday, August 19, 2005 7:56 PM
  • What I meant is the build log html file where the compiler and linker switches are specified.

    Thanks,
      Ayman Shoukry
      VC++ Team
    Friday, August 19, 2005 8:25 PM
    Moderator
  • Thanks Ayman, I found out the problem. One of my specific dependent library is built with /ML. I rebuilt it with /MD, and don't get linking error any more.
    Thank you for your time and help!
    Friday, August 19, 2005 9:22 PM
  •  Sunny H wrote:
    Thanks Ayman, I found out the problem. One of my specific dependent library is built with /ML. I rebuilt it with /MD, and don't get linking error any more.
    Thank you for your time and help!

     

    hi:

     

    I have the same problem like you that is can not open 'libc.lib'

    could you tell me the procedure of solving this problem . thanks !!!

    Friday, June 16, 2006 11:37 PM
  • Project Property -> Configuation Properties -> Linker -> Input -> Ignore Specific Library

    Ignore the LIBC.LIB

    I think it could fix your problems.

    Friday, July 14, 2006 3:48 AM
  • i was getting this error too and the above fixed the problem and it comiles ok but is it right thing to do. wonder why do i have to do that? would appreciated any explaination. thanks.
    Friday, July 14, 2006 6:25 AM
  •  

    Hi all,

     

    I did what was written: "Project Property -> Configuation Properties -> Linker -> Input -> Ignore Specific Library

    Ignore the LIBC.LIB"

     

    after that i got the following errros:

     

    LIBCMTD.lib(_file.obj) : error LNK2005: ___iob_func already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(dbgheap.obj) : error LNK2005: _calloc already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(dbgheap.obj) : error LNK2005: _realloc already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(dbgheap.obj) : error LNK2005: _free already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(fflush.obj) : error LNK2005: _fflush already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(tidtable.obj) : error LNK2005: __encoded_null already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(tidtable.obj) : error LNK2005: __decode_pointer already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(sprintf.obj) : error LNK2005: _sprintf already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRT.lib(cinitexe.obj)

    LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRT.lib(cinitexe.obj)

    LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRT.lib(cinitexe.obj)

    LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRT.lib(cinitexe.obj)

    LIBCMTD.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(winxfltr.obj) : error LNK2005: ___CppXcptFilter already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(dosmap.obj) : error LNK2005: __errno already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(strftime.obj) : error LNK2005: _strftime already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(mlock.obj) : error LNK2005: __lock already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(mlock.obj) : error LNK2005: __unlock already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(_wctype.obj) : error LNK2005: _iswspace already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(tzset.obj) : error LNK2005: __tzset already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(stricmp.obj) : error LNK2005: __stricmp already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(atox.obj) : error LNK2005: _atoi already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(printf.obj) : error LNK2005: _printf already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(getenv.obj) : error LNK2005: _getenv already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(tolower.obj) : error LNK2005: _tolower already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(strtol.obj) : error LNK2005: _strtol already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(strtol.obj) : error LNK2005: _strtoul already defined in MSVCRT.lib(MSVCR80.dll)

    LIBCMTD.lib(strnicmp.obj) : error LNK2005: __strnicmp already defined in MSVCRT.lib(MSVCR80.dll)

    Creating library lib\sipXtapi.lib and object lib\sipXtapi.exp

    LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

    LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library

    "

    Please can someone help me??

    Thursday, September 13, 2007 8:36 PM
  • You are linking against both libcmtd.lib and msvcrt.lib - you can't do this. One is the statically linked runtime (libcmtd.lib) and the other is the dynamically linked runtime (msvcrt.lib). You are also mixing debug libraries (libcmtd.lib) and release libraries (msvcrt.lib) this is also a very bad idea.

     

    You should double check your compiler and linker settings and ensure that you are using a consistent set of libraries.

     

    Thursday, September 13, 2007 8:44 PM
    Moderator
  • First thanks for replying.

     

    Well, I am trying to build a softphone called SipXezPhone. I ignored one library and i let the other, adn vice versa. But in both cases, i get errors!! what should i do??

    Thursday, September 13, 2007 10:06 PM
  • if anyone encountered this problem when working with openGL freeglut library (freeglut_static.lib) and using visual studio 2005, see
    this site:

    http://www.taekwondo.org.il/system/glutvc2005.html

    Thursday, October 18, 2007 10:47 AM
  • hello,

     

    i had the same problem.

     

    but i have found a solution. download the lib http://www.taekwondo.org.il/system/freeglut_static.lib and replace it with the existing. i think it works now.

     

    regards

     

    fb

    Tuesday, December 25, 2007 9:51 AM
  • I could solve this prblem in my case (using library (built with VC++ 2003) for controlling an RFID readers)

     

    1. Include the library file LIBC.LIB into your project (Project -> Ad existing item -> All files -> pick the Lib file)

     

    This step allow the project to build successfully

     

    2. Add LIBC.LIB to the folder corresponding to "C:\Program Files\Microsoft Visual Studio 8\VC\lib"

     

    After that you'll be able to link successfully...

     

     

     

     

    Thursday, April 24, 2008 12:30 PM
  • But I didn't find the libc.lib.  Can you tell me where can I get the libc.lib file ? Is it a free/shareware file ?

    Thanks.

    Saturday, July 12, 2008 5:04 PM
  • I solved this problem by switching to libcmt.lib (the multi-threaded version of libc.lib).  VC++ 6.0 supported libc.lib (single-thread, statically linked library), but VC++ 2005 and 2008 do not.  They offer only the multi-threaded static library.  Go with this option, and your project now supports concurrency if you ever need it... :-)

    Make the change in your Project Properties | Configuration Properties | Linker | Input window.  On the line for "Additional Dependencies", change libc.lib to libcmt.lib.

    I hope this helps!

    Jim
    Thursday, September 25, 2008 6:29 PM
  • In Project Properties under Linker, Input enter libc.lib in the field "Ignore Library". this works to solve the problem with freeglut_static
    Tuesday, February 03, 2009 3:26 PM
  • Hi all.
    I am using MsV c++ 2008(VS9, 2008) to build and compile a project provided with OTB 3.0 Package(open source).

    following linker errors occur-

    LINK : fatal error LNK1104: cannot open file 'LIBC.lib'
    Build log was saved at "file://f:\my folder\my_test\full\Examples\ChangeDetection\ChangeDetectionFrameworkExample.dir\Release\BuildLog.htm"
    ChangeDetectionFrameworkExample - 1 error(s), 0 warning(s)

    Each of my dependent projects are already set to runtime library as /MT (as suggested by a forum),as libc.lib is the single threaded static runtime
    library which is no longer available since VC8.


    On ignoring this particular libray(libc.lib) in linker-input options, I got following errors :
    ------ Build started: Project: ChangeDetectionFrameworkExample, Configuration: Release Win32 ------
    Linking...
    MSVCRT.lib(MSVCR90.dll) : error LNK2005: _exit already defined in LIBCMT.lib(crt0dat.obj)
    MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fprintf already defined in LIBCMT.lib(fprintf.obj)
    MSVCRT.lib(MSVCR90.dll) : error LNK2005: _sprintf already defined in LIBCMT.lib(sprintf.obj)
    MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fread already defined in LIBCMT.lib(fread.obj)
    MSVCRT.lib(MSVCR90.dll) : error LNK2005: _sscanf already defined in LIBCMT.lib(sscanf.obj)
    MSVCRT.lib(MSVCR90.dll) : error LNK2005: _getenv already defined in LIBCMT.lib(getenv.obj)
    MSVCRT.lib(MSVCR90.dll) : error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj)
    MSVCRT.lib(MSVCR90.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)
    MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
    MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
       Creating library F:\my folder\my_test\full\bin\Release\ChangeDetectionFrameworkExample.lib and object F:\my folder\my_test\full\bin\Release\ChangeDetectionFrameworkExample.exp
    LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
    F:\my folder\my_test\full\bin\Release\ChangeDetectionFrameworkExample.exe : fatal error LNK1169: one or more multiply defined symbols found
    Build log was saved at "file://f:\my folder\my_test\full\Examples\ChangeDetection\ChangeDetectionFrameworkExample.dir\Release\BuildLog.htm"
    ChangeDetectionFrameworkExample - 11 error(s), 1 warning(s)



    Now if I Ignore LIBCMT.lib too, following errors crop up:

    Creating library F:\my folder\my_test\full\bin\Release\ChangeDetectionFrameworkExample.lib and object F:\my folder\my_test\full\bin\Release\ChangeDetectionFrameworkExample.exp
    tiff.lib(tif_unix.obj) : error LNK2001: unresolved external symbol __iob
    geotiff.lib(geo_print.obj) : error LNK2001: unresolved external symbol __iob
    itkvnl.lib(vnl_math.obj) : error LNK2019: unresolved external symbol __HUGE referenced in function "double __cdecl vnl_huge_val(double)" (?vnl_huge_val@@YANN@Z)
    tiff.lib(tif_print.obj) : error LNK2001: unresolved external symbol __pctype
    tiff.lib(tif_print.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
    F:\my folder\my_test\full\bin\Release\ChangeDetectionFrameworkExample.exe : fatal error LNK1120: 4 unresolved externals.


    Please indicate where I am doing wrong,and corresponding solution.
    I'm struck :(
    I have to execute this project on my current platform.
    Friday, May 22, 2009 11:12 AM
  • Thanks, It's worked.
    Monday, September 14, 2009 10:15 AM
  • Project Property -> Configuation Properties -> Linker -> Input -> Ignore Specific Library

    Ignore the LIBC.LIB

    I think it could fix your problems.

    Hi
    I am converting from VS 2005 to VS 2008 and I am getting the following errors
    1>Linking...
    1>LINK : fatal error LNK1104: cannot open file 'LIBC.lib'
    1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\link.EXE"' : return code '0x450'
    1>Stop.
    1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"


    I've tried to ignore libc.lib but that still results in the same error

    the following is the buildlog
    Creating temporary file "C:\DOCUME~1\b1807973\LOCALS~1\Temp\BAT00011D12685000.bat" with contents
    [
    @echo off

    NMAKE /nologo /f SecurityAccessPS.mk

    if errorlevel 1 goto VCReportError

    goto VCEnd

    :VCReportError

    echo Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"

    exit 1

    :VCEnd
    ]

    not sure where to go from there
    Creating command line "C:\DOCUME~1\b1807973\LOCALS~1\Temp\BAT00011D12685000.bat"

    Wednesday, January 20, 2010 10:02 PM
  • Hi All,

    i have two projects under one solution.

    1) AutoUpdate as exe and 2) Update as dll.
    i am including AutoUpdate.h file into Update as i need to access functions from AutoUpdate.
    I am getting Unresolved extern symbol for the instance of AutoUpdate.


    extern CAutoUpdateApp theApp;

    theApp.SampleTest();


    Error 3 error LNK2001: unresolved external symbol "class CAutoUpdateApp theApp"

    Error 3 error LNK2019: unresolved external symbol "public: void __thiscall CAutoUpdateApp::SampleTest(void)"



    Thanks in Advance,
    Arjun.
    Friday, February 05, 2010 10:52 AM
  • u need to DLLEXPORT the function and then where you are using the exported function just DLLIMPORT it these are macros see their actual value.

    Alternatively you can also define a macro that lets you import dll in all other projects you have in your solution

    Friday, June 25, 2010 10:46 AM
  • I did this in VS 2010 and my dll built just fine, but it doesn't work on Windows XP.  Any ideas?
    Monday, April 09, 2012 11:28 PM
  • This fixed my problem, but only kind of.  The .dll project I am doing compiled and ran fine on Windows 7 after applying this fix, but it does not work on XP systems.  Any ideas why that could be.  I'm not really even sure where to start looking.
    Thursday, April 12, 2012 4:24 PM