71600

LNK1104: cannot open file 'kernel32.lib'

I Had VS2010 installed but found that intellisense wasn't working. I looked on the web and found that I wasn't the only one who had that issue. So, I installed VS2008 and everything was fine. Then I decided to clean up my computer and removed VS2010 and immediately started getting this error on my programs (new and old). Even a simple test program that has one cout command. I tried repairing VS2008 and that didn't work so I tried to uninstall and then reinstall and still I am getting the same problem.

I have looked online for this issue and though I have found a lot of other people are experiencing this issue it is not the same. They are having problems with other external references, not the ones that should automatically be included like kernel32 and lib32 etc.

I also tried the solution that worked for some people with their other references and I included the path (with and without quotes) to my kernel32 directory but still I get the same problem, or in some instances I will get

LNK1104: cannot open file 'C:\WINDOWS\system32.obj'

with and without quotes in the linker config.

Can anyone please help?

Answer1:

I think the option you are looking for here is -MT instead of -MD. I ran into the same problem. You will notice that when you use this option, the size of the DLL is much larger (includes dependencies)

Answer2:

I included the path (with and without quotes) to my kernel32 directory

It looks like you're pointing to C:\Windows\System32 which is where the DLL might be, but that's not where the .lib file will be.

In VS 2010 it's probably somewhere like:

C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib

I don't have ready access to VS2008 to say where kernel32.lib gets installed by default for that product.

Answer3:

In case somebody comes up to this again, I found the solution which worked for me.

In my case UAC from Win 7 and / or antivirus sortware was / were denying the access to kernel32.lib. After starting VS 2008 as an Admin and deactivating Virus Scan for the project folders it worked for me.

Answer4:

I had this problem and just resolved it. I had the SDK installed, however, the VCVARS32.bat couldn't find the SDK, so it defaulted to paths that didn't exist (where VS2008 is installed). I forced this to work by modifying the VCVARS32.bat ("C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat", see line 13): 11: @call :GetWindowsSdkDir 12: *13: @SET WindowsSdkDir=C:\Program Files\Microsoft SDKs\Windows\v6.0A\ 14: 15: @if not "%WindowsSdkDir%" == "" (

I had to do it this way as I have VS2008, VS2010 and VS2012 installed, as most of us probably do who have to support multiple projects across multiple teams, so updating anything global, like the actual environmental path, could lead to mixing SDK versions.

Recommend

  • can you create a lib or dll in VS 2005 and link with VS 2008
  • How to use 'boost_python-vc110-mt-gd-1_54.lib' in C++?
  • Boost.Python tries to link against python27.lib using Visual C++
  • Cannot Open File atls.lib
  • MongoDB Compass Visually Insert Sub-Document
  • Access VBScript variable within Javascript inside of an HTA
  • How to convert list into string with quotes in python
  • How to prepare a C++ string for sql query
  • a concept similar to pointers in as3?
  • What is Closure Compiler?
  • CUDA NSight is not installed with CUDA 5.0 installation file on Windows 8? [closed]
  • Netezza Incremental load from Sql server using SSIS
  • Pointer vs Reference difference when passing Eigen objects as arguments
  • Invert string in Rust
  • Less Conflicting Session Manager for Zope 2
  • Can my PDF ping my server when it is opened?
  • Pycharm: Marking a folder as 'sources root' is not recursive for subfolders
  • Implicit joins and Where in Doctrine - how?
  • calculate gradient output for Theta update rule
  • Web.config system.webserver errors
  • Button text different than value submitted in query string
  • Checking free space on FTP server
  • Change Inet root folder for iis 7
  • How to delay loading a property with linq to sql external mapping?
  • Excel - Autoshape get it's name from cell (value)
  • How to redirect a user to a different server and include HTTP basic authentication credentials?
  • script to move all files from one location to another location
  • Check if a string to interpolate provides expected placeholders
  • ILMerge & Keep Assembly Name
  • Can I make an Android app that runs a web view in Chrome 39?
  • Updated Ionic CLI but shows previous version (Windows)
  • Symfony2: How to get request parameter
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • RestKit - RKRequestDelegate does not exist
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Traverse Array and Display in markup
  • log4net write single file for each call to log.info
  • Exception on Android 4.0 `android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode)`
  • LevelDB C iterator
  • Linking SubReports Without LinkChild/LinkMaster