gcc-10: options order important?
Hi,
in contrary to previous versions, now in Debian 11 with gcc-10:
gcc aa.c -lm -o aa works, but
gcc -lm aa.c -o aa does not work, saying:
/usr/bin/ld: /tmp/ccWyhudO.o: in function `main':
aa.c:(.text+0x1f): undefined reference to `sqrt'
collect2: error: ld returned 1 exit status
My aa.c content:
-------------------------------------------
#include<stdio.h>
#include<math.h>
int main(void)
{
double x=4;
printf("sqrt(4)=%f\n",sqrt(x));
return 0;
}
-------------------------------------------
It seems that an option -lm cannot be placed in an arbitrary place which I used to
do. Is this intentional ?
Regards,
Piotr A. Dybczyński
--
/**************************************************************************
dr Piotr A. Dybczyński
homepage: https://www.dybczynski.pl/Piotr e-mail: piotr@dybczynski.pl
********************************************************************PAD***/
Reply to: