Date: Fri, 5 Jul 1996 15:26:59 -0600 (MDT) From: Dave Andersen <angio@aros.net> To: searle@longacre.demon.co.uk (Michael Searle) Cc: questions@freefall.freebsd.org Subject: Re: C libraries Message-ID: <199607052126.PAA23497@terra.aros.net> In-Reply-To: <mE9178E39@longacre.demon.co.uk> from "Michael Searle" at Jul 5, 96 08:24:18 pm
next in thread | previous in thread | raw e-mail | index | archive | help
gcc <files> -lm
*** -- link the math library in.
Lo and behold, Michael Searle once said:
>
> I have been having some problems getting C programs containing calls in
> math.h to link - is there a special library I have to use? I wrote a test
> program using sqrt(), but I get the same stuff for pow(), trig functions,
> etc. I am using standard gcc 2.6.3 on FreeBSD 2.1R. Here is the test
> program, the output I got from the linker, and my /usr/lib directory.
>
> It compiles and links OK, just using 'gcc sqrt.c -o sqrt', on a different
> (not FreeBSD) system running gcc 2.4.5.
>
> Also, one of the programs also needed Motif (the Xm library) to compile. Is
> there a free static version of the Motif library? (If so, where can I
> download it from?)
>
> sqrt.c:
>
> #include <math.h>
> #include <stdio.h>
>
> int main() {
> double x;
>
> fprintf(stdout,"What is your number?");
> fscanf(stdin,"%lf",&x);
>
> fprintf(stdout,"The square root of %lf is %lf.",x,sqrt(x));
>
> exit();
> }
--
angio@aros.net Complete virtual hosting and business-oriented
system administration Internet services. (WWW, FTP, email)
http://www.aros.net/ http://www.aros.net/about/virtual
"There are only two industries that refer to their customers as 'users'."
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199607052126.PAA23497>
