🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #1092

Re: Can't link in math libs in djgpp - extra info

#1092
From: Jos Horsmeier
Date: Fri, 21 Aug 1992 12:07
30 lines
1419 bytes
In article <glen.91.714362482@wench.ece.jcu.edu.au> glen@wench.ece.jcu.edu.au (Glen Harris) writes:
|>  I've installed all the djgpp distribution files in my djgpp directory, but 
|>when I try to use a maths function the error is as follows:
|>test.o: Undefined symbol _tan referenced from text segment
|>  I have all the set vars in my autoexec bat and a simple "Hello World" 
|>program works, so <stdio.h> is OK.  By the way I _am_ using <math.h>. 8-}
|>  Any ideas?
|
|  Sorry, I should have said that I am also using -lm as a compiler argument.

The order of the command line parameters is important (well, for _my_
compiler it is ...)

If you compile like this:

cc -lm myfile.c

it won't work, you have to change it into this:

cc myfile.c -lm

Due to the behavior of the linker (`ld' on Un*x) it would skip the
entire library (if mentioned first) if there are no functions 
read yet that depend on a function in that particular library.

I hope this helps a bit,

kind regards,

Jos aka jos@and.nl
Technical Details
Message-ID: <3269@dozo.and.nl>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sun4nl!and!jos
References: <glen.88.714352100@wench.ece.jcu.edu.au> <glen.91.714362482@wench.ece.jcu.edu.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sun4nl!and!jos
From: jos@and.nl (Jos Horsmeier)
Newsgroups: comp.os.msdos.programmer
Subject: Re: Can't link in math libs in djgpp - extra info
Message-ID: <3269@dozo.and.nl>
Date: 21 Aug 92 12:07:23 GMT
References: <glen.88.714352100@wench.ece.jcu.edu.au> <glen.91.714362482@wench.ece.jcu.edu.au>
Organization: AND Software BV Rotterdam
Lines: 30