www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/01/11/02:29:31

From: "Michael Schuster" <SCHUSTER AT merlin DOT e-technik DOT uni-erlangen DOT de>
Organization: LS f. Elektrische Energieversorgung
To: andrea DOT tasso AT galactica DOT it (andrea tasso), djgpp AT delorie DOT com
Date: Thu, 11 Jan 1996 08:22:31 MET
Subject: Re: help ! undefined reference when compiling

Gruess Dich!

> 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'.

I 've just tested your program, and you're right! The solvation of 
your problem is both tricky and simple. Compile with:

            gcc sin.c -lm

(Notice the position of -lm !). Now it'll work.

ciao

Michi

'Bye, bye Mister Pride' (ABC, Night you murdered Love)
----------------------------------------------------------------------
Dipl.-Ing                                       
Michael Schuster
Lehrstuhl fuer Elektrische Energieversorgung
Friedrich Alexander Universitaet Erlangen
Cauerstrasse 4
(0)9131 85 8761
----------------------------------------------------------------------

- Raw text -


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