*BSD News Article 19121


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!foxhound.dsto.gov.au!fang.dsto.gov.au!myall.awadi.com.au!blymn
From: blymn@awadi.com.au (Brett Lymn)
Newsgroups: comp.os.386bsd.bugs
Subject: Re: can't use function exp() in math.h
Date: 04 Aug 1993 20:00:10 GMT
Organization: AWA Defence Industries
Lines: 22
Message-ID: <BLYMN.93Aug4140024@mallee.awadi.com.au>
References: <23i8ro$l8d@usenet.INS.CWRU.Edu> <23i9dp$btk@news.cerf.net>
NNTP-Posting-Host: mallee.awadi.com.au
In-reply-to: speakez@nic.cerf.net's message of 2 Aug 1993 05:41:12 GMT

>>>>> On 2 Aug 1993 05:41:12 GMT, speakez@nic.cerf.net (Robert Crowe) said:
Robert> NNTP-Posting-Host: nic.cerf.net

Robert> In article <23i8ro$l8d@usenet.INS.CWRU.Edu> cc465@cleveland.Freenet.Edu (Steven M Ratliff) writes:
>
>	I've been trying to use the function exp() in math.h in a simple
>program under 386BSD + pk 2.4.  I've put in #include <math.h> at the top
>of the program but always get an error message when linking.
>The error is.  "Undefined symbol _exp referenced from text segment".
>I've explicitly tried linking in the math lib with cc -lm test.c and it still

Robert> Make sure the -lm comes after anything that references it (In this
Robert> case, after test.c).  Ld does one pass through libraries, and if it
Robert> doesn't need a symbol when it's scanning the library, it forgets about
Robert> it forever.

And do yourself a favour and NOT use test as the name for your
program, use trial or something else since test is a system utility
(unless you are actually replacing test!!!)

--
Brett Lymn