Incompatibility with `complex.h`: `error: user-defined literal operator not found`

The following code:

// test.cu
#include <stdio.h>
#include <complex.h>

int main() {
    float _Complex x = 0.0f + 1.0f*_Complex_I;
}
$ nvcc test.cu

Gives the compilation error:

test.cu(5): error: user-defined literal operator not found

1 error detected in the compilation of "/tmp/tmpxft_00007220_00000000-8_test.cpp1.ii".

While gcc and g++ compile perfectly fine

My nvcc version is:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130

Is there a widely accepted way to use complex numbers?

when I compile your code with CUDA 10.0.130 or 10.1.168, (RHEL 7, gcc 4.8.5) it compiles fine.

you may also wish to google cuComplex.h and thrust::complex

After downgrading to gcc 4.8.5 it worked, thanks!