Reputation: 465
Using Cuda 5.0, VS2010
This project compiles and links fine in VS2012 but VS2012 does not support Nsight debug so i am also developing in VS2010. So I have a VS2010 project file but am using identical source codes files (.h, .cpp, .cu, .cuh.
VS2010 build compiles everything fine, but linking reports error with unresolved external:
Generating Code...
1>videoFuncUnThread.obj : error LNK2019: unresolved external symbol _runKernel referenced in function "void __cdecl videoFuncUnThread(int,bool,unsigned int * const)" (?videoFuncUnThread@@YAXH_NQAI@Z)
1>D:\StrApp\Viper1B_10\Viper1B_10\Debug\Viper1B_10.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
the missing symbol, runKernel, is host-side module that calls device side modules (resident in PTX file).
when I search for all occurances of runKernel, I get 3 lines:
filter.cu(127): extern "C" CUresult runKernel (int numFrames, cudaStream_t stream, bool firstBatch, int* searchLimit) { ... } // module code
videofuncunthread.cpp(28): extern "C" CUresult runKernel(int numFrames, cudaStream_t stream, bool firstBatch, int* search); //
videofuncunthread.cpp(137): CUresult resultKernel = runKernel( NinBatch, gStream, firstBatch, (int *)searchLimit);
since "filter.cu" compiles it means that the invocation line (137) agrees with the prototype declaration (28); also you can see that the definition in filter.cu is identical with the prototype.
Finally I note that I have successfully compiled, linked and run examples from the cuda 5.0 samples on VS2010. i have verified that i am using the same Cuda build rules in both projects and that the project properties between my project and the Cuda sample project are the same.
any insight or suggestion you can offer would be greatly appreciated.
thanks
Upvotes: 6
Views: 4794
Reputation: 21108
Are you sure that VS2010 is building and linking your CUDA code? See this answer for notes on setting up VS2010, in particular enabling the CUDA build customisations. Also note that if you added .cu
files before the build customisations, then you'll need to set the type of the .cu
files to CUDA C/C++
(right-click on the file, Properties, set Item Type).
One quick check would be to make a change in the .cu
file and ensure it is being recompiled.
Upvotes: 5