[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
c, gcc, ld?
I have the following code snippet:
#include <stdio.h>
#include <math.h>
int main(void)
{
double i;
i = sqrt(9);
printf("%e\n",i);
return 0;
}
With g++, it compiles fine.
With gcc, I get:
"... undefined reference to 'sqrt'"
"collect2: ld returned 1 exit status code"
Now, at first I thought my home system was somehow misconfigured, since
it appears to be a linker problem. I tried the same code on another
machine, which should be properly configured, and got the same error.
So... what am I missing? Is it gcc, ld, or the code is simply wrong?
Thanks in advance!
--
mulix.
email: mulix@ibm.net
linux/reboot.h: #define LINUX_REBOOT_MAGIC1 0xfee1dead
=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il