TheGame
TheGame

Reputation: 161

Link error while Compiling CUDA from command prompt

I'm trying to compile a CUDA test program on Windows 7 x64 via Command Prompt using this command:

nvcc cuda.cu

I get the following output and then this error message:

cuda.cu
tmpxft_00000d14_00000000-3_cuda.cudafe1.gpu
tmpxft_00000d14_00000000-8_cuda.cudafe2.gpu
cuda.cu
tmpxft_00000d14_00000000-3_cuda.cudafe1.cpp
tmpxft_00000d14_00000000-14_cuda.ii
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'

I have the kernel.lib file in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib and adding that to the CUDA lib environment variable doesn't work.

What would be causing this error and how do I rectify it?

Upvotes: 1

Views: 2848

Answers (1)

harrism
harrism

Reputation: 27809

You should not specify the MS lib location in an environment variable. You need to use a '-L' command line option as in

nvcc <file> -L"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib"

Really you probably need Visual Studio installed because you need a host compiler to build your host code.

Upvotes: 2

Related Questions