none
VC2008: LNK1104 error: cannot open file 'kernel32.lib'

    Question

  • My C project used to work on my other laptop that had VS2008 (on XP) but it's not working on my new Vista-based machine. I just installed VS2008 fresh and tried building the project which resulted in the LNK1104 fatal error. The Additional Dependencies are set to be inherited from its parent (the inheriting list does include kernel32.lib). I have .NET framework 3.5 installed (came with VS2008).

    Any help is appreciated.
    Wednesday, April 16, 2008 12:21 AM

Answers

  • Hi,

     

    From above description, it seems you have set the “Additional Dependencies” correctly. Now, would you please check your library path setting?

    1.    Select “Options” from the “Tools” menu.

    2.    Select “Projects and Solutions > VC++ Directories” node in the opened “Options” dialog.

    3.    In the right panel of above node, Select “Library Files” from the ComboBox under “Show Directories for”, check whether “$(WindowsSdkDir)\lib” is included in the directories list, if not, manually add it. Notice: if your solution is X64 targeted, you should select X64 from the “Platform” ComboBox, and make sure that “$(WindowsSdkDir)\lib\x64” is included in the directories list. “$(WindowsSdkDir)” represents the installed directory of Windows SDK, you can replace it with the absolute path.

     

    If problem persists, please feel free to let us know!

     

    Thanks!

     

    Friday, April 18, 2008 8:22 AM
  • Hi,

     

    Firstly, would you please remove the entry “C:\Program Files\Microsoft SDKs\Windows\v5.0\lib\IA64” and just keep the entry “C:\Program Files\Microsoft SDKs\Windows\v5.0\lib”? The library files in “C:\Program Files\Microsoft SDKs\Windows\v5.0\lib\IA64”directory are for IA64 platform, you shouldn't add it to the directory list for Win32 platform.

     

    If problem persists, check whether “kernel32.lib” exists in “C:\Program Files\Microsoft SDKs\Windows\v5.0\lib”, if it doesn’t exist in that directory, try to reinstall the Windows SDK.

     

    Thanks!

     

    Tuesday, April 22, 2008 9:06 AM

All replies

  • Btw I have looked at project and solution files to see if there's any occurance of kernel32.lib but none. I should also mention that I tried creating a brand new project and importing only the source files but that went to no avail.

    I really need help. This is a part of my job and I am stuck!
    Thursday, April 17, 2008 6:38 PM
  • Hi,

     

    From above description, it seems you have set the “Additional Dependencies” correctly. Now, would you please check your library path setting?

    1.    Select “Options” from the “Tools” menu.

    2.    Select “Projects and Solutions > VC++ Directories” node in the opened “Options” dialog.

    3.    In the right panel of above node, Select “Library Files” from the ComboBox under “Show Directories for”, check whether “$(WindowsSdkDir)\lib” is included in the directories list, if not, manually add it. Notice: if your solution is X64 targeted, you should select X64 from the “Platform” ComboBox, and make sure that “$(WindowsSdkDir)\lib\x64” is included in the directories list. “$(WindowsSdkDir)” represents the installed directory of Windows SDK, you can replace it with the absolute path.

     

    If problem persists, please feel free to let us know!

     

    Thanks!

     

    Friday, April 18, 2008 8:22 AM
  • Thanks for trying to assist. Yes the path is included uder Library Files...However I just checked the path for my Windows SDK and seems like this is it:
    C:\Program Files\Microsoft SDKs\Windows\v5.0\

    Under the above directory there's a Lib directory which has a subfolder called IA64; does this belong to a 64-bit system? Mine's 32-bit and I don't see any other folders than IA64 under v5.0\Lib... Anyways I tried replacing “$(WindowsSdkDir)” with the above path; didn't work.

    Do I need to separately download and install Windows Vista SDK? But then why should I?

    Thanks.


    Friday, April 18, 2008 7:03 PM
  • Hi,

     

    Thanks for your instant response!

     

    From your description, it seems that the two directories "C:\Program Files\Microsoft SDKs\Windows\v5.0\" and "C:\Program Files\Microsoft SDKs\Windows\v5.0\IA64" are both included in the "Library Files" directory list for Win32 platform. If it is, would you please replace "C:\Program Files\Microsoft SDKs\Windows\v5.0\" with "C:\Program Files\Microsoft SDKs\Windows\v5.0\lib"?

    Monday, April 21, 2008 1:54 AM
  • Thanks but that didn't work either. I even added a separate line with the above address to the "Library Files" in addition to changing “$(WindowsSdkDir)” and “$(WindowsSdkDir)\lib”...

    The \IA64 folder does contain kernel32.lib so I thought if I included "C:\Program Files\Microsoft SDKs\Windows\v5.0\lib\IA64" to the list it would work. But instead the compiler gave me a bunch of new errors (LNK2019 caused by MSVCRTD.lib) but no more LNK1104.

    This is really frustrating. I cannot get paid because of this -can't get any work done.
    Monday, April 21, 2008 11:23 PM
  • Hi,

     

    Firstly, would you please remove the entry “C:\Program Files\Microsoft SDKs\Windows\v5.0\lib\IA64” and just keep the entry “C:\Program Files\Microsoft SDKs\Windows\v5.0\lib”? The library files in “C:\Program Files\Microsoft SDKs\Windows\v5.0\lib\IA64”directory are for IA64 platform, you shouldn't add it to the directory list for Win32 platform.

     

    If problem persists, check whether “kernel32.lib” exists in “C:\Program Files\Microsoft SDKs\Windows\v5.0\lib”, if it doesn’t exist in that directory, try to reinstall the Windows SDK.

     

    Thanks!

     

    Tuesday, April 22, 2008 9:06 AM
  • Yes, as I mentioned I had tried the path with and without the \IA64 part and it did not work. Inside \v5.0\lib there's no kernel32.lib. I'm going to install Windows SDK manually but shouldn't have been part of Visual Studio installation process? I mean, if kernel32.lib is a library used by VS then why doesn't it add it during the installation?
    Tuesday, April 22, 2008 11:08 PM
  • I installed Windows Vista SDK Update and it's fixed now. But still, why didn't VS install whatever was necessary?

    Thanks again for the help!
    Wednesday, April 23, 2008 2:06 AM
  • Hi,

     

    By default, Windows SDK v6.0A is installed during VS 2008 installation. And the default installation directory is “C:\Program Files\Microsoft SDKs\Windows\v6.0A”.

    Does this directory exist on your machine? If not, did you change the installing configuration when installing VS2008? If not, maybe some error occurs during VS2008 installation.

     

    Thanks!

     

    Wednesday, April 23, 2008 2:31 AM
  • Yes, v6.0A is there but it neither has a \lib subfolder nor the kernel32.lib file. All I see there are 2 folders: \bin and \bootstrapper.
    • Proposed as answer by anidiart Friday, January 30, 2009 10:46 AM
    Wednesday, April 23, 2008 11:45 PM
  • I have the same problem as asadim did. This forum has been of great help but I still cannot solve it. I also have the Visual Studio 2008, although installed in WIndows XP,  and I have the same error messages of kernel32. So I installed the new version 6.1 of Windows SDK and made it the current version for Visual Studio 2008, but I still get the error LNK2019 MSVCRTD.lib

     Does anybody knows what could I try now?

     Thanks in advance for the help!

     

     Andres

    Friday, January 30, 2009 10:50 AM
  • Hello All, I'm new to this forum, but I'm glad to see I'm not the only one who has this problem.  Asadim and anidiart both say what I have to say and I have XP Home as well.  I got the full program Visual Studio 2k8 from dreamspark.com and since I'm running out of space on my hd, I only installed what I thought I needed.  I didn't install the .Net stuff but just the basics to get me running for school.  I was however able to run VB programs w/o issue.  This only happened when I started running C++ programs.  I thought it was my coding, but I seemed to clean up the errors, rebuilt it & this is what I have (above error).  I was thinking of reinstalling the whole thing, but if I can just reinstall the SDK (I have to look that up as well) I'm thinking all will be well.
    I will check back to see what anyone has come up with, but will return w/any news I have as well.
    Thanks,
    Adz end
    Friday, December 04, 2009 2:29 AM