出现这个问题。找到了原因是,在global函数中调用了__device__函数,但是这两个文件不在同一个src文件里面。

http://stackoverflow.com/questions/31006581/cuda-device-unresolved-extern-function

The issue is that you defined a __device__ function in separate compilation unit from __global__that calls it. You need to either explicitely enable relocatable device code mode by adding -dc flag or move your definition to the same unit.

From nvcc documentation:

--device-c|-dc Compile each .c/.cc/.cpp/.cxx/.cu input file into an object file that contains relocatable device code. It is equivalent to --relocatable-device-code=true --compile.

See Separate Compilation and Linking of CUDA C++ Device Code for more information.

http://stackoverflow.com/questions/17188527/cuda-external-class-linkage-and-unresolved-extern-function-in-ptxas-file

因此解决的方式有2个。

第一是两个函数放到同一个cu文件中。

第二是在cu文件属性页面选项卡中 cuda c/c++->common->Generate Relocatable Device Code 选择-rdc=true。允许重定位device代码编译。或者在整个工程的cuda c/c++项中配置这个-rdc=true.

解决问题。

其他参考

https://devtalk.nvidia.com/default/topic/524436/how-to-deal-with-ptxas-fatal-error-unresolved-extern-function-39-cudagetparameterbuffer-39-/

1) View -> Property Pages
2) Configuration Properties -> CUDA C/C++ -> Common -> Generate Relocatable Device Code -> Yes (-rdc=true)
3) Configuration Properties -> CUDA C/C++ -> Code Generation -> compute_35,sm_35
4) Configuration Properties -> Linker -> Input -> Additional Dependencies -> cudadevrt.lib

cuda编译错误 ptxas fatal : Unresolved extern function xxxx相关推荐

  1. yocto编译错误- Error executing a python function in exec_python_func() autogenerated

    yocto编译错误 主要错误信息 **ERROR: fsl-image-validation-imx-1.0-r0 do_rootfs: Error executing a python functi ...

  2. matconvnet 编译错误 : nvcc fatal '-DNEDBUG': expected a number

    matconvnet 编译错误 按方法Win10安装MatConvnet和Window环境MatConvNet安装编译cpu 版本matconvnet 通过,但gpu版本报错,如下 错误信息为 nvc ...

  3. VC6.0的一个编译错误:fatal error C1001: INTERNAL COMPILER ERROR。

    最近在编译一个VC6.0工程(开发环境:win2000+VS6.0+Sp6),在加入预编译头后出现了下面的编译错误提示: c:/program files/microsoft visual studi ...

  4. VS2010编译错误:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x

    编译VTK,MFC时,mfc对版本的要求问题: 解决方法原文链接:http://www.cnblogs.com/madhenry/archive/2011/06/29/2093678.html 最近拿 ...

  5. VS2008(SP1)资源编译错误:fatal error RC1015: cannot open include file 'afxres.h'.

    只要一改动资源,按F7编译就会出现两个错误: error RC2001: newline in constant fatal error RC1015: cannot open include fil ...

  6. php.h not found,编译错误“fatal error: 'xxxx.h' file not found” 如何解决

    我们可能经常会出现编译错误的问题,本文作者也是在编译一个开源程序时遇到错误,然后整理出来,后面还带了一个在Mac OS X 上编译 Android 时的一个错误解决方法. 编译一个开源项目时遇到这样一 ...

  7. 解决Fatal error: Maximum function nesting level of

    今天在调试程序时,有个模版一直白板,最后跟踪到一个加@屏蔽报错的函数,去掉这个@后程序包了一个从没见过的错误, Fatal error: Maximum function nesting level ...

  8. 编译Qt“NMAKE:fatal error U1077”错误的解决方法

    编译Qt"NMAKE:fatal error U1077"错误的解决方法 分类: 错误与解决方法 2013-03-18 20:17 1775人阅读 评论(0) 收藏 举报 Qtfa ...

  9. 关于编译错误 fatal error C1083: Cannot open precompiled header file

        今天编译一个比较大的工程时,总是遇到这样的编译错误,想必凡是用过VC6.0做过比较大的程序或者做过MFC开发的朋友都遇到过.错误提示如下,fatal error C1083:Cannot op ...

最新文章

  1. java查看文件夹下文件夹大小,java 获取文件夹大小,文件大小,文件个数
  2. android窗口管理机制
  3. 线程池传递对象参数_一次线程池参数错误引起的线上故障
  4. Google Map 中混淆和压缩代码的简单示例
  5. python3 struct.pack方法报错argument for 's' must be a bytes object
  6. java 获取指定后缀名的文件
  7. PHP抽象类与接口的区别
  8. 从非数组对象转数组方法小结
  9. 原始尺寸_三维扫描检测,铸件三维全尺寸检测,铸件三维扫描服务
  10. 2021年上半年软考真题网络工程师真题及答案解析
  11. 一份某品牌天猫专卖店运营计划书
  12. 龙之谷怎么进去服务器维护,龙之谷端游服务器爆满怎么进
  13. java代码抛出异常_Java中编写代码出现异常,如何抛出异常,如何捕获异常
  14. 一个博士在华为的22年!
  15. 电脑远程登录控制Android手机-Webkey For Android使用教程
  16. 计算机网络协议(五)——DNS、HTTPDNS
  17. 代码Verify简介
  18. QT qrand()随机函数不随机?
  19. 【SWAT水文模型】SWAT水文模型建立及应用第四期: 气象数据的准备(中国区域高精度同化气象站CMADS)
  20. java输出九乘九乘法表

热门文章

  1. linux bootrom ftp,H3C交换机通过以太口应用ftp方式升级bootrom软件
  2. javascript如何获取request中的数据
  3. 联想拯救者y9000p和r9000p的区别
  4. halcon学习笔记-车牌号识别
  5. 苹果电脑快捷锁屏的几种方法
  6. 为什么我们放弃了 Vue?Vue 和 React 深度对比
  7. break语句和continue语句---两个跳转语句的区别
  8. Simon IELTS: Reading
  9. Vue指令之列表渲染
  10. 常用的社会信息公开查询