Sanix
March 7, 2011, 12:56pm
1
Hi,
I tried to set up a very simple CUDA project in Visual Studio 2010.
I installed the following software packages:
Visual Studio 2008 (since CUDA still needs to old compiler…)
Visual Studio 2010 (in which I created the project)
CUDA SDK 2.3 Windows 7 64 bit
parallel nsight host and monitor
cuda toolkit 3.2.16 64 bit
I took the project from this page How to Run CUDA In Visual Studio 2010 | The GPU Blog
I set the compiler to V 9.0
I selected in build customization “CUDA 3.2 targets and props”
Now I tried to build the project but get the following errors:
1>------ Rebuild All started: Project: VS2010Test, Configuration: Debug Win32 ------
1>
1> C:\Users\Daniel Suter\Downloads\VS2010Test\VS2010Test>“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\bin\nvcc.exe” -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin” -I"C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\common\inc" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\include" -G0 --keep-dir “Debug\” -maxrregcount=32 --machine 32 --compile -D_NEXUS_DEBUG -g -Xcompiler "/EHsc /nologo /Od /Zi /MTd " -o “Debug\kernel.obj” “C:\Users\Daniel Suter\Downloads\VS2010Test\VS2010Test\kernel.cu” -clean
1> Compiling CUDA source file kernel.cu…
1>
1> C:\Users\Daniel Suter\Downloads\VS2010Test\VS2010Test>“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\bin\nvcc.exe” -gencode=arch=compute_10,code="sm_10,compute_10" --use-local-env --cl-version 2008 -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin” -I"C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\common\inc" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\include" -G0 --keep-dir “Debug\” -maxrregcount=32 --machine 32 --compile -D_NEXUS_DEBUG -g -Xcompiler "/EHsc /nologo /Od /Zi /MTd " -o “Debug\kernel.obj” “C:\Users\Daniel Suter\Downloads\VS2010Test\VS2010Test\kernel.cu”
1> tmpxft_00000d98_00000000-11_kernel.ii
1> Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
1>
1> Copyright (C) Microsoft Corporation. All rights reserved.
1>
1>
1>kernel.obj : error LNK2019: unresolved external symbol _cudaConfigureCall@32 referenced in function _main
1>kernel.obj : error LNK2019: unresolved external symbol _cudaMemcpy@16 referenced in function _main
1>kernel.obj : error LNK2019: unresolved external symbol _cudaMalloc@8 referenced in function _main
1>kernel.obj : error LNK2019: unresolved external symbol _cudaSetupArgument@12 referenced in function “void __cdecl __device_stub__Z10kernelTestPii(int *,int)” (?__device_stub__Z10kernelTestPii@@YAXPAHH @Z)
1>kernel.obj : error LNK2019: unresolved external symbol ___cudaRegisterFunction@40 referenced in function “void __cdecl __sti____cudaRegisterAll_41_tmpxft_00000d98_00000000_3_kernel_cpp1_ii_434c419b(void)” (?__sti____cudaRegisterAll_41_tmpxft_00000d98_00000000_3_kernel_cpp1_ii_434c419b@@YAXXZ )
1>kernel.obj : error LNK2019: unresolved external symbol ___cudaRegisterFatBinary@4 referenced in function “void __cdecl __sti____cudaRegisterAll_41_tmpxft_00000d98_00000000_3_kernel_cpp1_ii_434c419b(void)” (?__sti____cudaRegisterAll_41_tmpxft_00000d98_00000000_3_kernel_cpp1_ii_434c419b@@YAXXZ )
1>kernel.obj : error LNK2019: unresolved external symbol ___cudaUnregisterFatBinary@4 referenced in function “void __cdecl __cudaUnregisterBinaryUtil(void)” (?__cudaUnregisterBinaryUtil@@YAXXZ )
1>kernel.obj : error LNK2019: unresolved external symbol _cudaLaunch@4 referenced in function “enum cudaError __cdecl cudaLaunch(char *)” (??$cudaLaunch@D@@YA ?AW4cudaError@@PAD @Z)
1>D:\Projekte\c#\CUDA\Debug\VS2010Test.exe : fatal error LNK1120: 8 unresolved externals
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
I googled a bit and tried to add the header files cutil.h and cutil_inline.h directly in
CUDA C/C++ Properties - Additional include directories - C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\common\inc;%(Include)
But I still get the same error.
VS2010Test.zip (1.32 MB)
Hi, you have linker error. Did you tell VS2010 where to look for CUDA libraries? (Should be under %CUDA_LIB_PATH%)
Edit: Oops accidently typed VS2008 by mistake.
Sanix
March 11, 2011, 2:00pm
4
Hi, Thanks for your answer.
It looks like you can specify it in millions of different locations. It’s really complicated, where should I reference it?
It referenced it at the following places:
Property Pages → CUDA C/C++ → Source Dependencies and Additional Include Directories
This didn’t help.
In the Linker section:
Additional Library Dependencies
Didn’t help either
In the VC++ Directories section:
Include directories
This didn’t help either
Looks like this is some mess, since it’s not really clear where to specify it.
Donos
March 11, 2011, 4:17pm
5
Hello,
I also tested and get linker errors while compiling the samples…
I tried 2 configurations :
[*]Windows 7 x64 + VisualStudio 2010 + CUDA 3.2[*]Windows 7 x64 + VisualStudio 2010 + CUDA 4.0 RC
It’s kinda weird since I programmed my own HelloWorld (launching a kernel that makes a simple multiplication) and it works perfectly althought I was using “cutils”.
I tried to execute “deviceQuery_vs2008” from the samples of CUDA 4.0 SDK and :
[*]It works fine with Visual C++ Express 2008[*]linker errors with VisualStudio 2010
It seems that VS 2010 has a different way to link project files, doesn’t it ?
If anybody can help…