Linking CUDA files

After monts of working on a one project, I needed to play a little bit with a smaller program from SDK file.

I moved it to separate location, recreated a new project file for my VS2008 (didn’t want to use original ones). Now I am trying to compile everything.

I set additional directories:

include directories for nvcc: “$(NVSDKCUDA_ROOT)\common\inc”

lib directories for linker: “$(CUDA_LIB_PATH);$(NVSDKCUDA_ROOT)\common\lib”

both environment variables exist and are equal to:

CUDA_LIB_PATH==C:\CUDA\lib

NVSDKCUDA_ROOT==C:\Documents and Settings\All Users\Application Data\NVIDIA Corporation\NVIDIA CUDA SDK

compilation goes well, but I cannot make it to link everything together.

1>Linking…

1>LINK : warning LNK4098: defaultlib ‘LIBCMT’ conflicts with use of other libs; use /NODEFAULTLIB:library

1>scanLargeArray.cu.obj : error LNK2019: unresolved external symbol __imp__cutCheckCmdLineFlag@12 referenced in function “void __cdecl __cutilExit(int,char * *)” (?__cutilExit@@YAXHPAPAD@Z)

1>scanLargeArray.cu.obj : error LNK2019: unresolved external symbol _cudaGetDeviceProperties@8 referenced in function “int __cdecl cutGetMaxGflopsDeviceId(void)” (?cutGetMaxGflopsDeviceId@@YAHXZ)

1>scanLargeArray.cu.obj : error LNK2019: unresolved external symbol _cudaGetDeviceCount@4 referenced in function “int __cdecl cutGetMaxGflopsDeviceId(void)” (?cutGetMaxGflopsDeviceId@@YAHXZ)

[…]

1>scanLargeArray.cu.obj : error LNK2019: unresolved external symbol ___cudaRegisterFunction@40 referenced in function ___sti____cudaRegisterAll_49_tmpxft_00000ec0_00000000_6_scan

LargeArray_cpp1_ii_839760fd

1>scanLargeArray.cu.obj : error LNK2019: unresolved external symbol ___cudaRegisterFatBinary@4 referenced in function ___sti____cudaRegisterAll_49_tmpxft_00000ec0_00000000_6_scan

LargeArray_cpp1_ii_839760fd

1>E:\CUDA\PrefixSum\SDK\Debug\SDKPrefixSum.exe : fatal error LNK1120: 26 unresolved externals

Any ideas what I missed?

  1. You shouldn’t be using CUTIL at all, it was developed for the SDK and is not safe for production code as it may change without warning. I’d strongly suggest you strip the CUTIL stuff out of the SDK example if you are going to use it.

  2. If you must use cutil, I believe your problem is that you need to specify cutil32.lib or cutil32D.lib under Linker > Input > Additional Dependencies

Since I was building a project taken from SDK I didn’t want to edit tens of lines to get cutil out.
cutil32.lib, cutil32D.lib - that was the part I missed. Many thanks!