CUDA 5.0 error LNK2001: unresolved external symbol for cuda methods

孤者浪人 提交于 2019-12-06 09:41:57

问题


I have error in linker

1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>kernel.cu.obj : error LNK2001: unresolved external symbol _cudaMalloc@8
1>kernel.cu.obj : error LNK2001: unresolved external symbol _cudaFree@4

I saw similar question added here : Unresolved external symbols in beginners CUDA program But it's already have added this information to linker.

So where is the problem ? I'm using Visual Studio 2010 Premium with CUDA SDK 5.0 and Nsight 3.0 for VS

Source code here : http://pastebin.com/DfdfSfWd (It's a example generated by Visual Studio on created new project for CUDA 5.0)

[EDIT]

Settings for Linker

Configuration Properties->Linker->General->Additional Library Directories :

$(CudaToolkitLibDir) $(CUDA_LIB_PATH) $(CUDA_PATH)\lib\$(PlatformName)

Configuration Properties->Linker->Input->Additional Dependencies

cuda.lib;cudart.lib; and the other libs..

But in properties I see that CUDA haves own Linder, "CUDA Linker" and that doesnt have set

Additional Library Directories

and

Additional Dependencies

so I set this properties but nothing that change, the linker still have problem.

[EDIT]

Ok, the error is when I change

Configuration Properties->CUDA C/C++->Device->Code Generation

from

compute_10,sm_10

to

compute_20,sm_20

and add a flag -dc for CUDA C/C++


回答1:


Ok, I found how to set the project for Separate Compilation & Linking, below we have an example of project where it work : example simpleSeparateCompilation



来源:https://stackoverflow.com/questions/13900798/cuda-5-0-error-lnk2001-unresolved-external-symbol-for-cuda-methods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!