1

I am getting an error while trying to compile CUDA code with the -std=c++11 flag.

error: more than one instance of overloaded function "isnan" matches the argument list:
        function "isnan(float)"
        function "std::isnan(float)"
        argument types are: (r32)

(r32 is a typedef for float)

I found this question, in which the answer suggests to simply not specify C++11 to fix the problem, which I can not do because I am using some features of C++11 like constexpr and lambdas. Is there a way of compiling with C++11 features turned on, and still resolve this ambiguity?

I am using the following command to compile:

 nvcc -I/my/include/path/1 -I/usr/local/cuda/include src/myfile.cu -o build/myfile.o -arch=sm_61 -c --compiler-options -fPIC -Xcudafe -std=c++11

the compiler version is:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:03_CST_2017
Cuda compilation tools, release 8.0, V8.0.61

Any help or suggestion would be greatly appreciated. Thanks!

meetaig
  • 913
  • 10
  • 26

1 Answers1

0

While this overload conflict problem was an issue with the CUDA 8 release compiler, it was fixed for the CUDA 9 release and anyone experiencing this issue should upgrade to CUDA 9 or newer.

[This answer was assembled from comments and added as a community wiki answer]

talonmies
  • 70,661
  • 34
  • 192
  • 269
  • I'm using CUDA 11.6 and still get this error. However replacing `isnan` with `std::isnan` as explained [here](https://stackoverflow.com/questions/33770374/why-is-isnan-ambiguous-and-how-to-avoid-it) works for me. – SimonH Jan 26 '22 at 11:22