none
cannot open file 'kernel32.lib'

    Question

  • Hello everyone,

            I have created an application which references a dll for implementation.But everytime I try building the program,I am getting a linker error as follows:

     

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

     

    Also,I have gone in the VCProjectDefaults directory, on my system it is under C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults. I have checked corewin_express.vcprops. There is an attribute there called AdditionalDependencies.I am sure that it has kernel32.lib in there. It reads something like:

    AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"

     

    Also I am not including these .lib files in my linker>input>additional dependencies,since they are present here,but then I get an error:

     

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

     

    Then in order to remove this error I made the following changes in my code:

     

    #pragma lib <LIBCMTD.lib>

    #pragma comment (linker,"/NODEFAULTLIB:libcmtd.lib")

     

    Then I get the following error:

     

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

     

     

    Kindly help.

     

    Tuesday, August 21, 2007 11:02 AM

Answers

  • Hello

     

    Does this happens to any other new created visual c++ projects? It looks very un-common but one thing that do in common is that all these libraries are reside in $(VCInstallDir)lib, which is "C:\Program Files\Microsoft Visual Studio 8\VC\lib" for most machines. So please try to verify this:

    In Tools | Options | Project and Solution | VC++ Directories | Show Directories For -> Library files, make sure "$(VCInstallDir)lib" is in the list, if there is no such item in the list or the item is wrong, please add "$(VCInstallDir)lib" to the list.

     

    hope it makes sense

    rico

    Friday, August 24, 2007 9:17 AM
    Moderator

All replies

  • Hello

     

    Does this happens to any other new created visual c++ projects? It looks very un-common but one thing that do in common is that all these libraries are reside in $(VCInstallDir)lib, which is "C:\Program Files\Microsoft Visual Studio 8\VC\lib" for most machines. So please try to verify this:

    In Tools | Options | Project and Solution | VC++ Directories | Show Directories For -> Library files, make sure "$(VCInstallDir)lib" is in the list, if there is no such item in the list or the item is wrong, please add "$(VCInstallDir)lib" to the list.

     

    hope it makes sense

    rico

    Friday, August 24, 2007 9:17 AM
    Moderator
  • ok i have same problem but in the library directorys it says i have $(VCInstallDir)lib and it still says cant find ''kernel32.lib
    Wednesday, August 12, 2009 11:37 PM