delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/01/11/19:17:43

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 <demmer AT LSTM DOT Ruhr-UNI-Bochum DOT De>
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: <DKz6nI DOT Eqt AT jade DOT mv DOT net>
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<math.h>
> 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019