
Libraries to link under Linux's gcc compiler
NOTE: This message has been posted to the comp.lang.c moderated and
comp.lang.c newsgroups under the same title.
Greetings,
While compiling a simple program
------------------------
#include <stdio.h>
#include <math.h>
int main()
{
printf("The square root of 81 is %f", sqrt(81.0));
return (0);
Quote:
}
--------------------------
using gcc 2.8.1 under SuSE Linux 6.1, I kept getting error messages
stating the sqrt was an unknown function. After I learned that I needed
to link in the math library, the problem resolved.
There was nothing in any documentation that I could find that said to
link in the math library. My concern is about the other things out there
that needed libraries to be linked in and will bite me as this one did
today.... <g>.
Where can I find which functions needed to have what libraries linked
when linking programs under gcc? Is there a master list that says if you
use, for example sqrt, you need to link in the math library?
Thanx.
B. O'Fallon
"The only dumb question is the one that isn't asked"
--