On Aug 29, 2022, at 11:18, Patrick Dupre <pdupre(a)gmx.com> wrote:
I can compile this code with gcc (-lm)
but not with clang
test.c:8:22: warning: implicit declaration of function 'CMPLX' is invalid in C99
[-Wimplicit-function-declaration]
double complex z = CMPLX (1., 2.) ;
^
1 warning generated.
/usr/bin/ld: /tmp/test-52cb2b.o: in function `main':
test.c:(.text+0x1b): undefined reference to `CMPLX'
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <complex.h>
int main () {
double complex z = CMPLX (1., 2.) ;
}
I could not find any option of clang which let me compile it without this error.
You might want to check out this bugzilla BZ, it describes the problem and why it happens.
https://sourceware.org/bugzilla/show_bug.cgi?id=26287
--
Jonathan Billings