I am trying to generate random numbers using the Host API Example in the CUDA Toolkit 4.0 CURAND Guide and I am encountering errors when I try to compile the .cu file with nvcc. The platform I am working on is Windows 7 and compiling through the Visual Studio 2008 x64 Win64 Command Prompt and CUDA is v3.2. The error I am getting is LNK2019: unresolved external symbol. From what I can tell, nvcc can’t find the functions built into CURAND. I assume it can find the curand.h file, since it doesn’t give me an error for that. I’ve added the proper paths to all the files in the cuda toolkit to the PATH environment variable in the system preferences (specifically: %CUDA_PATH%\bin, %CUDA_PATH%\lib\x64, %CUDA_PATH%\include). I can compile other .cu files which have CUDA functions such as dim3, cudaMalloc, cudaMemcpy, etc. I’ve tried compiling the .cu files which came in the CUDA SDK examples e.g. the Monte Carlo calculations of pi, and I get the same LNK2019 error. What is going wrong?
Below is the out put on the command prompt. The random.cu file is exactly the same as the Host API Example shown in the CUDA Toolkit 4.0 CURAND Guide (January 2011).
C:\Users\____\Documents\CUDA>nvcc random.cu
random.cu
tmpxft_00001158_00000000-3_random.cudafe1.gpu
tmpxft_00001158_00000000-8_random.cudafe2.gpu
random.cu
tmpxft_00001158_00000000-3_random.cudafe1.cpp
tmpxft_00001158_00000000-14_random.ii
tmpxft_00001158_00000000-15_random.obj : error LNK2019: unresolved external symbol curandDestroyGenerator referenced in function main
tmpxft_00001158_00000000-15_random.obj : error LNK2019: unresolved external symbol curandGenerateUniform referenced in function main
tmpxft_00001158_00000000-15_random.obj : error LNK2019: unresolved external symbol curandSetPseudoRandomGeneratorSeed referenced in function main
tmpxft_00001158_00000000-15_random.obj : error LNK2019: unresolved external symbol curandCreateGenerator referenced in function main
a.exe : fatal error LNK1120: 4 unresolved externals