www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/12/08/07:27:24

Xref: news-dnh.mv.net comp.os.msdos.djgpp:3690
Path: news-dnh.mv.net!mv!news.sprintlink.net!news.Edu.TW!newsserver.jvnc.net!news.caren.net!news.join.ad.jp!news.imnet.ad.jp!usenet.seri.re.kr!news.kreonet.re.kr!news.dacom.co.kr!newsfeed.internetmci.com!in2.uu.net!EU.net!peer-news.britain.eu.net!sunsite.doc.ic.ac.uk!cs.city.ac.uk!sl323
From: sl323 AT city DOT ac DOT uk (Mark Lewis)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: header file <math.h>
Date: 7 Dec 1995 14:18:43 GMT
Organization: School of Informatics, City University, London
Lines: 45
References: <DJ11BI DOT 2xy AT jade DOT mv DOT net>
Reply-To: M DOT Lewis AT city DOT ac DOT uk
Nntp-Posting-Host: paddington.city.ac.uk
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

You need to link the math library to your executable to use math functions.
Use the -lm flag at the END of your compile command line.

--
..--------------------------{ From:  Mark Lewis }--------------------------.
|   Computing Services     |     http://www.city.ac.uk/~sl323/            |
|   City University        |     PGP public key available by WWW, or by   |
|   London,  England       |     fingering sl323 AT finger DOT city DOT ac DOT uk        |
`--------{ M DOT Lewis AT city DOT ac DOT uk (MIME) | nostra AT city DOT ac DOT uk (MIME) }---------'

THutchi141 AT aol DOT com wrote:
> Hi,

> I am a new user of djgpp.  I have downloaded several zip files and have
> successfully
> compiled several simple C programs.  However, I have not been able to use the
> include
> file <math.h>.  A simple program, such as:

> #include <stdio.h>
> #include <math.h>

> main()
> {
>      printf("%d\n",sin(3.0));
> }

> produces an error:

> "ex2-2.c (.text + 0x24): undefined reference sin"

> during compilation.  If I use another math function in place of sin, I get
> the same error (
> except with "sin" in the error statement replaced by the appropriate
> function).
> I have searched through the file math.h and have found that it has a
> statement:
> #include <math-68881.h>
> in it.  However, upon looking through all of my files associated with djgpp,
> I am unable
> to find math-68881.h.  Could there be a *.zip file that I may need to
> install?  Any 
> suggestions would be helpful.  Thanks.

> Todd Hutchinson

- Raw text -


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