From mboxrd@z Thu Jan 1 00:00:00 1970 From: Art Haas To: help-gcc@gnu.org Subject: Re: math.h prob Date: Wed, 03 Nov 1999 08:27:00 -0000 Message-id: References: <38204719.FD2DC371@clinmed.gla.ac.uk> X-SW-Source: 1999-11/msg00011.html Dave Brennan <9147261b@clinmed.gla.ac.uk> writes: > Hi, > > I am having problems using maths functions. e.g if I have the program > > #include > #include > > main() > { > double x; > scanf("%lf",&x); > printf("x = %lf",sqrt(x)); > } > > and try to compile it using, > > gcc -o test mattest.c > > I get the following error: > > Undefined first referenced > symbol in file > sqrt /var/tmp/cc9Eay_r1.o > ld: fatal: Symbol referencing errors. No output written to test > You need to link in the math library ... % gcc -o test mattest.c -lm -- ############################### # Art Haas # (713) 689-2417 ############################### From mboxrd@z Thu Jan 1 00:00:00 1970 From: Art Haas To: help-gcc@gnu.org Subject: Re: math.h prob Date: Tue, 30 Nov 1999 23:28:00 -0000 Message-ID: References: <38204719.FD2DC371@clinmed.gla.ac.uk> X-SW-Source: 1999-11n/msg00011.html Message-ID: <19991130232800.Z_eZ1jLE2qzZ9fZhaJBPj0AHe15GQRyvd_Y2qnWQDx4@z> Dave Brennan <9147261b@clinmed.gla.ac.uk> writes: > Hi, > > I am having problems using maths functions. e.g if I have the program > > #include > #include > > main() > { > double x; > scanf("%lf",&x); > printf("x = %lf",sqrt(x)); > } > > and try to compile it using, > > gcc -o test mattest.c > > I get the following error: > > Undefined first referenced > symbol in file > sqrt /var/tmp/cc9Eay_r1.o > ld: fatal: Symbol referencing errors. No output written to test > You need to link in the math library ... % gcc -o test mattest.c -lm -- ############################### # Art Haas # (713) 689-2417 ###############################