horaceT
horaceT

Reputation: 651

CUDA 6.5 with g++ does not support c++11?

I read it here that CUDA 6.5 has started support for C++11 :

https://groups.google.com/forum/#!topic/thrust-users/R37GIkMG4tk

But when I compile an example code below, I got

$ nvcc -std=c++11 cu-gcc11.cu -o test

nvcc warning : The -c++11 flag is not supported with the configured host compiler. Flag will be ignored.

cu-gcc11.cu(7): error: explicit type is missing ("int" assumed)

My setting : CUDA 6.5, g++ 4.5, ubuntu 12.04

Codes :

#include <cuda.h>
#include <iostream>

__host__ void test() {
  float a = 12.;
  double b = 3.;
  auto c = a * b;
  std::cout << c << std::endl;
}

int main()
{
  test();
  return 0;
}

Upvotes: 1

Views: 2143

Answers (2)

bluescarni
bluescarni

Reputation: 3997

I don't think -std=c++11 was available in GCC 4.5. Try -std=c++0x.

Upvotes: 1

Robert Crovella
Robert Crovella

Reputation: 151799

C++11 support in nvcc is experimental at this time. In order to properly use it you will need an appropriate configuration. This is not documented anywhere AFAIK, but you should have good results with either Fedora 20 or Ubuntu 14.04, both of which are supported configs for cuda 6.5 and include GCC 4.8.x.

In your case your GCC version is just too old.

Upvotes: 5

Related Questions