WIN32 XP LNK2019 Error

Hi there,

I’m having problems setting up cuda on a new machine, prior to this one i setup CUDA on a win7 64 coding 32bit apps though. Everything worked, now im setting up this computer and i have problems with the linker. I have tried several library paths and searched for a solution, no matter how i try to include the additional libraries i cannot get rid of the linking error.

I have also tried compiling simple hello world example and i still get LNK2019 error with less unresolved symbols.

Im running win xp pro with sp3, cuda toolkit 3.2, cuda sdk 3.2, graphics driver 263.06, Visual C++ 2008, Windows SDK 7.1, geforce gt240SC.

Hardware: geforce gt240SC, AMD Sempron 2Ghz 1G ram (please don’t laugh, it’s a temp PC)

Using CUDA Runtime API Build Rule 3.2

I’m having problems building sample.cu. I’ve installed Cuda VS Wizzard W32 2.2 beta.

Under CUDA Runtime API the runtime library is /MTd

I have setup new envrironment variables:

SDK_INC_PATH -> %NVSDKCOMPUTE_ROOT%\C\common\inc

SDK_BIN_PATH -> %NVSDKCOMPUTE_ROOT%\C\bin\win32

SDK_LIB_PATH -> %NVSDKCOMPUTE_ROOT%\C\common\lib

I have included all the above sdk paths into the VC++ Directories for execute, library, and include files.

Under Linker->General->Additional Library Directories i have (CUDA_LIB_PATH) and (SDK_LIB_PATH)

Under Linker->Input-> Ad. Dependencies i have cudart.lib, cutil32D.lib, kernal32.lib

The /LIBPATH in Linker command line is the correct path.

Please let me know if i left out any important info about my setup. Thanks.

Compiling with CUDA Build Rule...

"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\\bin\nvcc.exe"    -gencode=arch=compute_10,code=\"sm_10,compute_10\" -gencode=arch=compute_20,code=\"sm_20,compute_20\"  --machine 32 -ccbin "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin"    -Xcompiler "/EHsc /W3 /nologo /O2 /Zi   /MT  "  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\\include" -maxrregcount=32  --compile -o "Debug/sample.cu.obj" sample.cu 

sample.cu

tmpxft_00000fdc_00000000-6_sample.compute_10.cudafe1.gpu

tmpxft_00000fdc_00000000-10_sample.compute_10.cudafe2.gpu

sample.cu

tmpxft_00000fdc_00000000-3_sample.compute_20.cudafe1.gpu

tmpxft_00000fdc_00000000-14_sample.compute_20.cudafe2.gpu

sample.cu

sample.cu

tmpxft_00000fdc_00000000-6_sample.compute_10.cudafe1.cpp

tmpxft_00000fdc_00000000-23_sample.compute_10.ii

Linking...

sample.cu.obj : error LNK2019: unresolved external symbol _cudaGetErrorString@4 referenced in function "void __cdecl __cudaSafeCall(enum cudaError,char const *,int)" (?__cudaSafeCall@@YAXW4cudaError@@PBDH@Z)

sample.cu.obj : error LNK2019: unresolved external symbol _cudaGetLastError@0 referenced in function "void __cdecl __cutilCheckMsg(char const *,char const *,int)" (?__cutilCheckMsg@@YAXPBD0H@Z)

sample.cu.obj : error LNK2019: unresolved external symbol _cudaSetDevice@4 referenced in function "bool __cdecl InitCUDA(void)" (?InitCUDA@@YA_NXZ)

sample.cu.obj : error LNK2019: unresolved external symbol _cudaGetDeviceProperties@8 referenced in function "bool __cdecl InitCUDA(void)" (?InitCUDA@@YA_NXZ)

sample.cu.obj : error LNK2019: unresolved external symbol _cudaGetDeviceCount@4 referenced in function "bool __cdecl InitCUDA(void)" (?InitCUDA@@YA_NXZ)

sample.cu.obj : error LNK2019: unresolved external symbol ___cudaUnregisterFatBinary@4 referenced in function "void __cdecl __cudaUnregisterBinaryUtil(void)" (?__cudaUnregisterBinaryUtil@@YAXXZ)

sample.cu.obj : error LNK2019: unresolved external symbol _cudaLaunch@4 referenced in function "enum cudaError __cdecl cudaLaunch<char>(char *)" (??$cudaLaunch@D@@YA?AW4cudaError@@PAD@Z)

sample.cu.obj : error LNK2019: unresolved external symbol _cudaSetupArgument@12 referenced in function "void __cdecl __device_stub__Z9HelloCUDAPci(char *,int)" (?__device_stub__Z9HelloCUDAPci@@YAXPADH@Z)

sample.cu.obj : error LNK2019: unresolved external symbol ___cudaRegisterFunction@40 referenced in function "void __cdecl __sti____cudaRegisterAll_52_tmpxft_00000fdc_00000000_8_sample_compute_10_cpp1_ii_9c215084(void)" (?__sti____cudaRegisterAll_52_tmpxft_00000fdc_00000000_8_sample_compute_10_cpp1_ii_9c215084@@YAXXZ)

sample.cu.obj : error LNK2019: unresolved external symbol ___cudaRegisterFatBinary@4 referenced in function "void __cdecl __sti____cudaRegisterAll_52_tmpxft_00000fdc_00000000_8_sample_compute_10_cpp1_ii_9c215084(void)" (?__sti____cudaRegisterAll_52_tmpxft_00000fdc_00000000_8_sample_compute_10_cpp1_ii_9c215084@@YAXXZ)

sample.cu.obj : error LNK2019: unresolved external symbol _cudaFree@4 referenced in function _main

sample.cu.obj : error LNK2019: unresolved external symbol _cudaMemcpy@16 referenced in function _main

sample.cu.obj : error LNK2019: unresolved external symbol _cudaThreadSynchronize@0 referenced in function _main

sample.cu.obj : error LNK2019: unresolved external symbol _cudaConfigureCall@32 referenced in function _main

sample.cu.obj : error LNK2019: unresolved external symbol _cudaMalloc@8 referenced in function _main

C:\Documents and Settings\Alex\My Documents\Visual Studio 2008\Projects\CUDAWinApp12\Debug\CUDAWinApp12.exe : fatal error LNK1120: 15 unresolved externals

Build log was saved at "file://c:\Documents and Settings\Alex\My Documents\Visual Studio 2008\Projects\CUDAWinApp12\CUDAWinApp12\Debug\BuildLog.htm"

CUDAWinApp12 - 16 error(s), 0 warning(s)

========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

I have also tried compiling the sample using CUDA Driver API 3.2 and i get this error:

mt.exe : general error C10100b1; Failed to load "..\Debug\CUDAWinApp12.exe". The system cannot find the file specified.

SOLVED IT.

The problem was with the new (Toolkit 3.2) cudart.lib file. Had to use the toolkit 3.1 cudart.lib file.