programming in Red hat 7.2 include error without -O

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, all

I had a function and cc it in redhat 7.2,
but if I use
$gcc PROGRAM_NAME,
there will be error :

/tmp/ccAXzZTF.o: In function `main':
/tmp/ccAXzZTF.o(.text+0x32): undefined reference to `sqrt'
collect2: ld returned 1 exit status

but if I use -O or -O2 to gcc, it works well !!
I do not know why, the following is source code


#include <stdio.h>
#include <math.h>

int main(void)
{

double pi = M_PI;
double pisqrt;
long i;

for (i = 0; i < 10000000; ++i) {
pisqrt = sqrt(pi);
}
return 0;
}



_______________________________________________
Redhat-devel-list mailing list
Redhat-devel-list@redhat.com
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

[Index of Archives]     [Kernel Newbies]     [Red Hat General]     [Fedora]     [Red Hat Install]     [Linux Kernel Development]     [Yosemite News]

  Powered by Linux