使用CUDA 8.0与GCC 6.x - 错误的函数重载投诉 [英] Using CUDA 8.0 with GCC 6.x - bad function overloading complaint

查看:3176
本文介绍了使用CUDA 8.0与GCC 6.x - 错误的函数重载投诉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用GCC 6.2.1编译一些CUDA代码,我的分配的默认编译器(注意:不是CUDA正式支持的GCC版本,所以你可以调用这个实验)。这是使用GCC 4.9.3和CUDA版本7.5和8.0构建的代码。



好吧,如果我构建以下(接近)最小示例: / p>

  #include< tuple> 

int main(){return 0; }

使用命令行

  nvcc -std = c ++ 11 -Wno-deprecated-gpu-targets -o main main.cu 

我得到以下错误:

  / usr / local / cuda / bin /。 ./targets/x86_64-linux/include/math_functions.h(8897):错误:无法通过单独的返回类型区分重载函数

/usr/local/cuda/bin/../targets/x86_64 -linux / include / math_functions.h(8901):错误:无法通过返回类型单独识别的重载函数

在编译/tmp/tmpxft_000071fe_00000000-9_b.cpp1.ii时检测到2个错误。

为什么?

解决方案

看来其他人已经看到这个问题与GCC 6.1.x ,建议是添加以下标志到nvcc: -Xcompiler -D__CORRECT_ISO_CPP11_MATH_H_PROTO (是的,两个连续的标志;细节参见 nvcc --help )。 (但我不能报告完全成功,因为其他问题弹出来,而不是。)



无论如何,记住GCC 5.4.x是最新支持的版本,一个很好的理由,所以它有点像一个疯狂的追逐甚至尝试GCC 6.x与CUDA 8。


I'm trying to build some CUDA code using GCC 6.2.1, the default compiler of my distribution (Note: not a GCC version officially supported by CUDA, so you can call this experimental). This is code which builds fine with GCC 4.9.3 and both CUDA versions 7.5 and 8.0.

Well, if I build the following (close-to) minimal example:

#include <tuple>

int main() { return 0; }

with the command-line

nvcc -std=c++11 -Wno-deprecated-gpu-targets -o main main.cu

I get the following errors:

/usr/local/cuda/bin/../targets/x86_64-linux/include/math_functions.h(8897): error: cannot overload functions distinguished by return type alone

/usr/local/cuda/bin/../targets/x86_64-linux/include/math_functions.h(8901): error: cannot overload functions distinguished by return type alone

2 errors detected in the compilation of "/tmp/tmpxft_000071fe_00000000-9_b.cpp1.ii".

Why is that? How can I correct/circumvent this?

解决方案

It seems other people have seen this issue with GCC 6.1.x and the suggestion is to add the following flags to nvcc: -Xcompiler -D__CORRECT_ISO_CPP11_MATH_H_PROTO (yes, two successive flags; see nvcc --help for details). (But I can't report complete success since other issues pop up instead.)

Anyway, remember that GCC 5.4.x is the latest supported version, and that probably has a good reason, so it's somewhat of a wild goose chase to even try GCC 6.x with CUDA 8.

这篇关于使用CUDA 8.0与GCC 6.x - 错误的函数重载投诉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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