Xref: news-dnh.mv.net comp.os.msdos.djgpp:4271 Path: news-dnh.mv.net!mv!news.sprintlink.net!news.heurikon.com!news.dpc.net!novia!news.inc.net!news.uoregon.edu!newsxfer.itd.umich.edu!news.mathworks.com!news.kei.com!nntp.coast.net!lll-winken.llnl.gov!uwm.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!blackbush.xlink.net!rz.uni-karlsruhe.de!news.uni-stuttgart.de!news.ruhr-uni-bochum.de!usenet From: Thomas Demmer Newsgroups: comp.os.msdos.djgpp Subject: Re: help ! undefined reference when compiling Date: Thu, 11 Jan 1996 11:54:48 +0100 Organization: Lehrstuhl fuer Stroemungsmechanik Lines: 34 Message-ID: <30F4EC78.167E@LSTM.Ruhr-UNI-Bochum.De> References: NNTP-Posting-Host: bvb.lstm.ruhr-uni-bochum.de To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp andrea tasso wrote: > > HI ! > > When compiling the following program with djgpp for dos > > #include > void main (void) > { > > double d , n ; > d = 40.05 ; > n = sin ( d ) ; > > } > > with the command: gcc -lm sin.c > > I get the following error message: > > sin.c(.text+0x20): undefined reference to 'sin'. > > The same program compile successfully with gcc for Linux. > You note that hello.c ( in \samples\hello of djgpp dist ) compile also with > djgpp for dos, and gcc sees math.h, and the math library libm.a is present. > thank you very much for your help. Use gcc sin.c -lm ld is a one-pass linker that remembers all unreferenced procedures and then resolves them. That is, it ploughs through libm.a, finds nothing important, then reads sin.o and realizes it needs _sin, but will not find it. Ciao Tom