And with optimization, the compiler would discover that it can compute
the sqrt at compile time and put the answer into the object code, which
is why you don't need the sqrt routine linked in with optimization
enabled. BTW, if this is a "time killer" program, the optimized
version would run SIGNI
Hi,
The "sqrt" function is in libm, you should use: gcc PROGRAM_NAME -lm
Venkatesh
>
> 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 referen
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 kn