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

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:

[code]nvcc --compiler-bindir "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" -I. -I/usr/include -m32 cuda_correlator.cu cube/cube.c -o cuda_correlator
cuda_correlator.cu
tmpxft_000011c8_00000000-3_cuda_correlator.cudafe1.gpu
tmpxft_000011c8_00000000-11_cuda_correlator.cudafe2.gpu
cuda_correlator.cu
tmpxft_000011c8_00000000-3_cuda_correlator.cudafe1.cpp
tmpxft_000011c8_00000000-17_cuda_correlator.ii
cube.c
tmpxft_000011c8_00000000-6_cube.cudafe1.gpu
tmpxft_000011c8_00000000-21_cube.cudafe2.gpu
cube.c
tmpxft_000011c8_00000000-6_cube.cudafe1.cpp
tmpxft_000011c8_00000000-27_cube.ii
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
make: *** [cuda_correlator] Error 2
[/code]

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.
Hi,



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 cuda_correlator.cu cube/cube.c -o cuda_correlator   

cuda_correlator.cu

tmpxft_000011c8_00000000-3_cuda_correlator.cudafe1.gpu

tmpxft_000011c8_00000000-11_cuda_correlator.cudafe2.gpu

cuda_correlator.cu

tmpxft_000011c8_00000000-3_cuda_correlator.cudafe1.cpp

tmpxft_000011c8_00000000-17_cuda_correlator.ii

cube.c

tmpxft_000011c8_00000000-6_cube.cudafe1.gpu

tmpxft_000011c8_00000000-21_cube.cudafe2.gpu

cube.c

tmpxft_000011c8_00000000-6_cube.cudafe1.cpp

tmpxft_000011c8_00000000-27_cube.ii

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.

#1
Posted 08/08/2011 03:23 PM   
I have the same Problem.
I have the same Problem.

#2
Posted 08/09/2011 09:00 AM   
I worked out the source my problem, and I was correct, it was a *real* simple one to fix /rolleyes.gif' class='bbc_emoticon' alt=':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

[code]nvcc --compiler-bindir "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" -I. -I/usr/include -m32 cuda_correlator.cu 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[/code]

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.gif' class='bbc_emoticon' alt=':haha:' />
I worked out the source my problem, and I was correct, it was a *real* simple one to fix /rolleyes.gif' class='bbc_emoticon' alt=':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 cuda_correlator.cu 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.gif' class='bbc_emoticon' alt=':haha:' />

#3
Posted 08/10/2011 01:21 PM   
Scroll To Top