CUDA 5.0错误LNK2001:cuda方法的未解析的外部符号 [英] CUDA 5.0 error LNK2001: unresolved external symbol for cuda methods

查看:1445
本文介绍了CUDA 5.0错误LNK2001:cuda方法的未解析的外部符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在链接器中有错误

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

我在这里看到类似的问题:
初学者未解决的外部符号CUDA程序
但它已经将此信息添加到链接器。

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

那么问题在哪里?
我使用Visual Studio 2010 Premium与CUDA SDK 5.0和Nsight 3.0 for VS

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

源代码在这里: http://pastebin.com/DfdfSfWd
(这是Visual Studio为CUDA 5.0创建的新项目生成的示例)

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

链接器的设置


配置属性 - >链接器 - >常规 - >其他库目录:

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

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

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

配置属性 - >链接器 - >输入 - >附加依赖关系

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

cuda.lib; cudart。 lib;和其他libs。

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

但是在属性中我看到CUDA拥有自己的Linder,CUDA链接器 / p>

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


其他资料库目录

Additional Library Directories

p>

and


其他依赖项

Additional Dependencies

但是没有什么改变,链接器仍然有问题。

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

我更改


配置属性 - > CUDA C / C ++ - >设备 - >代码生成

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

来自


compute_10,sm_10

compute_10,sm_10


compute_20,sm_20

compute_20,sm_20

并为CUDA C / C ++添加标志-dc

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

推荐答案

如何设置项目为独立编译&链接,下面我们有一个工程的例子:
example simpleSeparateCompilation

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

这篇关于CUDA 5.0错误LNK2001:cuda方法的未解析的外部符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆