I'm having trouble using the C99 complex
data type with FFTW and C++14.
// fftw14.cc
#include <complex.h>
#include <fftw3.h>
int main() {
fftw_complex* in;
in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * 100);
in[0] = 1337.42;
return 0;
}
There is no problem when I compile it with g++ fftw14.cc -lfftw3 -lm
. However, using C++14 (g++ -std=c++14 fftw14.cc -lfftw3 -lm
), fftw_complex
gets double[2]
and hence the implicit typecast fails.
fftw14.cc: In function ‘int main()’:
fftw14.cc:11:8: error: incompatible types in assignment of ‘double’ to ‘fftw_complex {aka double [2]}’
in[0] = 1337.42;
^
Why is that? I know I could mess around with the std::complex<double>
type, but I would like to avoid that.