HELP, error linking on Windows 7 cannot open file 'kernel32.lib'


I am attempting to port a linux application to Windows 7, and I have so far completely failed to get even a single line compilation command to work. I am using cygwin with the cl.exe compiler which I believe should work. However, I get the following error:

nvcc --compiler-bindir "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" -I. -I/usr/include -m32 cube/cube.c -o cuda_correlator











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

make: *** [cuda_correlator] Error 2

The compilation completes, but at link time the ‘kernel32.lib’ cannot not be found. This is located in the C:\Program Files\Microsoft SDKs\Windows\v7.1\lib directory, well at least the file "Kernel32.Lib’ is present, but I guess the capitalization shouldn’t matter. I also tried adding this path to the compile line with the ‘-L’ option, but this didn’t help. I am using Microsoft Visual Studio v10, Windows 7 Pro SP1 and I have installed the Windows SDK.

I am sure this is a trivial problem that is easy to fix, but I am completely new to this Windows development thing, and so any help would be greatly appreciated.

I have the same Problem.

I worked out the source my problem, and I was correct, it was a real simple one to fix :rolleyes:

Coming from a unix background I hadn’t realized that when I pass the compiler the library linking path, I had to specify it using dos notation, i.e., replace all my cygwin paths which use “/” with a dos style path “c:”. So the correct command to compile is

nvcc --compiler-bindir "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" -I. -I/usr/include -m32 cube/cube.c -o cuda_correlator --compiler-bindir "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" -L"c:\Program Files\Microsoft SDKs\Windows\v7.1\Lib" -Xcompiler /openmp

I wrote the path name correctly in my original post even, but I was stuck in unix-isms when presented with a bash prompt :haha: