Hello,
I’m just getting started with CUDA. The problem is that I cannot get the code to build with VS 2010. The reason is a series of linking errors (LNK2019). This must be due to some VS settings (or lack of “#include ”). I tried the sample code from the very first page of the Thrust library description. As soon as it gets to thrust::device_vector … it has linking errors. The code samples (VS projects) from CUDA SDK build and run just fine.
THANK YOU IN ADVANCE FOR YOUR HELP!!!
Here is an example of a program that will not build on my system:
#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
int main()
{
thrust::host_vector<int> vectorHost(2);
vectorHost[0] = 1;
vectorHost[1] = 4;
thrust::device_vector<int> vectorDevice = vectorHost; //THE ADDITION OF THIS LINE CAUSES LNK ERRORS
return 0;
}
Here are the LNK errors that I get:
1>main.cu.obj : error LNK2019: unresolved external symbol ___cudaRegisterFatBinary@4 referenced in function “void __cdecl __sti____cudaRegisterAll_39_tmpxft_000014c0_00000000_3_main_cpp1_ii_main(void)” (?__sti____cudaRegisterAll_39_tmpxft_000014c0_00000000_3_main_cpp1_ii_main@@YAXXZ)
1>main.cu.obj : error LNK2019: unresolved external symbol ___cudaUnregisterFatBinary@4 referenced in function “void __cdecl __cudaUnregisterBinaryUtil(void)” (?__cudaUnregisterBinaryUtil@@YAXXZ)
1>main.cu.obj : error LNK2019: unresolved external symbol _cudaFree@4 referenced in function “void __cdecl thrust::detail::backend::cuda::free<0>(class thrust::device_ptr)” (??$free@$0A@@cuda@backend@detail@thrust@@YAXV?$device_ptr@X@3@@Z)
1>main.cu.obj : error LNK2019: unresolved external symbol _cudaGetErrorString@4 referenced in function "public: virtual class std::basic_string<char,struct std::char_traits,class std::allocator > __thiscall thrust::system::detail::cuda_error_category::message(int)const " (?message@cuda_error_category@detail@system@thrust@@UBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z)
1>main.cu.obj : error LNK2019: unresolved external symbol _cudaMalloc@8 referenced in function “class thrust::device_ptr __cdecl thrust::detail::backend::cuda::malloc<0>(unsigned int)” (??$malloc@$0A@@cuda@backend@detail@thrust@@YA?AV?$device_ptr@X@3@I@Z)
1>main.cu.obj : error LNK2019: unresolved external symbol _cudaMemcpy@16 referenced in function “void __cdecl thrust::detail::backend::cuda::detail::checked_cudaMemcpy(void *,void const *,unsigned int,enum cudaMemcpyKind)” (?checked_cudaMemcpy@detail@cuda@backend@1thrust@@YAXPAXPBXIW4cudaMemcpyKind@@@Z)