home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / msdos / programm / 8687 < prev    next >
Encoding:
Internet Message Format  |  1992-08-21  |  1.3 KB

  1. Path: sparky!uunet!mcsun!sun4nl!and!jos
  2. From: jos@and.nl (Jos Horsmeier)
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: Re: Can't link in math libs in djgpp - extra info
  5. Message-ID: <3269@dozo.and.nl>
  6. Date: 21 Aug 92 12:07:23 GMT
  7. References: <glen.88.714352100@wench.ece.jcu.edu.au> <glen.91.714362482@wench.ece.jcu.edu.au>
  8. Organization: AND Software BV Rotterdam
  9. Lines: 30
  10.  
  11. In article <glen.91.714362482@wench.ece.jcu.edu.au> glen@wench.ece.jcu.edu.au (Glen Harris) writes:
  12. |>  I've installed all the djgpp distribution files in my djgpp directory, but 
  13. |>when I try to use a maths function the error is as follows:
  14. |>test.o: Undefined symbol _tan referenced from text segment
  15. |>  I have all the set vars in my autoexec bat and a simple "Hello World" 
  16. |>program works, so <stdio.h> is OK.  By the way I _am_ using <math.h>. 8-}
  17. |>  Any ideas?
  18. |
  19. |  Sorry, I should have said that I am also using -lm as a compiler argument.
  20.  
  21. The order of the command line parameters is important (well, for _my_
  22. compiler it is ...)
  23.  
  24. If you compile like this:
  25.  
  26. cc -lm myfile.c
  27.  
  28. it won't work, you have to change it into this:
  29.  
  30. cc myfile.c -lm
  31.  
  32. Due to the behavior of the linker (`ld' on Un*x) it would skip the
  33. entire library (if mentioned first) if there are no functions 
  34. read yet that depend on a function in that particular library.
  35.  
  36. I hope this helps a bit,
  37.  
  38. kind regards,
  39.  
  40. Jos aka jos@and.nl
  41.