From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arthur Gold To: help-gcc@gnu.org Subject: Re: math.h Date: Tue, 19 Oct 1999 22:29:00 -0000 Message-id: <380D52AF.1543D11B@bga.com> References: <380D58F1.B400EF83@primenet.com> X-SW-Source: 1999-10/msg00324.html "Dennis J. Sylvester" wrote: > > I tried using the sqrt() function with gcc and get an error : undefined > reference to 'sqrt'. If I compile with g++ I have no problem. I get > the same result when trying to use pow() also. What am I missing? > > Any help would be appreciated. > > Dennis Add the option -lm to your command line when you compile. ...and read the FAQs...and the docs...it's all in there...in fact if you LOOK, this has probably been covered at least twice this week on this and similar newsgroups... HTH, --ag -- Artie Gold, Austin, TX mailto:agold@bga.com or mailto:agold@cs.utexas.edu -- Pet peeve: "its" = belonging or pertaining to "it" | "it's" = "it is" From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arthur Gold To: help-gcc@gnu.org Subject: Re: math.h Date: Sun, 31 Oct 1999 13:57:00 -0000 Message-ID: <380D52AF.1543D11B@bga.com> References: <380D58F1.B400EF83@primenet.com> X-SW-Source: 1999-10n/msg00324.html Message-ID: <19991031135700.8s8_f11XiEUt67TFU_7dTQ-KjYxABtRQJm9zvZy_qfs@z> "Dennis J. Sylvester" wrote: > > I tried using the sqrt() function with gcc and get an error : undefined > reference to 'sqrt'. If I compile with g++ I have no problem. I get > the same result when trying to use pow() also. What am I missing? > > Any help would be appreciated. > > Dennis Add the option -lm to your command line when you compile. ...and read the FAQs...and the docs...it's all in there...in fact if you LOOK, this has probably been covered at least twice this week on this and similar newsgroups... HTH, --ag -- Artie Gold, Austin, TX mailto:agold@bga.com or mailto:agold@cs.utexas.edu -- Pet peeve: "its" = belonging or pertaining to "it" | "it's" = "it is"