一个以上的重载函数实例 [英] More than one instance of overloaded function

查看:203
本文介绍了一个以上的重载函数实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在使用CUDA 8.0和clang 3.8的Ubuntu系统上编译使用CUDA的库。
该库在几个 *。cu 文件中包括 Eigen 头,其中显然包括 cmath 标头,导致CUDA标头中的模棱两可。

I am trying to compile a library that uses CUDA, on an Ubuntu system using CUDA 8.0 and clang 3.8. The library includes Eigen headers in several *.cu files, which apparently includes the cmath header, causing an ambiguity in the CUDA headers.

/usr/local/cuda-8.0/include/cuda_fp16.h(3068): error: more than one instance of overloaded function "isinf" matches the argument list:
            function "std::isinf(float)"
            function "isinf(float)"
            argument types are: (float)

CUDA定义了自己的 __ device__ __RETURN_TYPE isinf(float a),我希望 std :: isinf 必须显式调用,而不是造成冲突。

CUDA defines its own __device__ ​ __RETURN_TYPE isinf ( float a ), and I would expect that std::isinf would have to be called explicitly rather than create a conflict.

对此,任何线索都将不胜感激。

Any leads on this would be much appreciated.

推荐答案

我记得,这实际上是一个Clang问题。使用Clang 3.8和gcc 6标准库头在C ++ 11模式下进行编译将触发此问题。如果您切换到受支持的gcc 5版本,或者未指定C ++ 11支持,则问题将消失。

As I recall, this is actually a Clang problem. Compiling in C++11 mode with Clang 3.8 and gcc 6 standard library headers will trigger the problem. If you switch to a supported gcc 5 version, or don't specify C++11 support, the problem will disappear.

这篇关于一个以上的重载函数实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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