CUDA 5.0 error LNK2001: unresolved external symbol

2019-04-15 04:22发布

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条回答
孤傲高冷的网名
2楼-- · 2019-04-15 04:43

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

查看更多
登录 后发表回答