home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / linux / 25470 < prev    next >
Encoding:
Text File  |  1993-01-25  |  1.3 KB  |  40 lines

  1. Newsgroups: comp.os.linux
  2. Path: sparky!uunet!spool.mu.edu!caen!batcomputer!db.TC.Cornell.EDU!mdw
  3. From: mdw@db.TC.Cornell.EDU (Matt Welsh)
  4. Subject: Re: gcc 2.3.3 problem
  5. Message-ID: <1993Jan26.002313.6776@tc.cornell.edu>
  6. Sender: news@tc.cornell.edu
  7. Nntp-Posting-Host: db.tc.cornell.edu
  8. Organization: Linux
  9. References: <1993Jan25.144702.4734@hp9000.csc.cuhk.hk>
  10. Date: Tue, 26 Jan 1993 00:23:13 GMT
  11. Lines: 27
  12.  
  13. In article <1993Jan25.144702.4734@hp9000.csc.cuhk.hk> a080700@hp9000.csc.cuhk.hk (Stephen Wong S M) writes:
  14. >I'm using linux 0.99pl4/SLS 1.0/gcc 2.3.3/lib 4.2 and I test the
  15. >gcc compiler with the following program:-
  16. [Program deleted]
  17. >
  18. >I use the following command line to compile:-
  19. >gcc -lm -o test_sqrt test_sqrt.c
  20. >
  21. >but I got the following error message:-
  22. >/usr/tmp/cca001331.o: Undefined symbot _sqrt referenced from text segment
  23.  
  24. No, it's not a bug in the compiler. The order of .o's, .c's, and -l or .a's
  25. matters. Try the command
  26.     gcc -o test_sqrt test_sqrt.c -lm
  27. (note new placement of -lm switch).
  28.  
  29. >Then I tried another command line:-
  30. >gcc -o test_sqrt test_sqrt.c /usr/lib/libm.a
  31. >and succeed.
  32.  
  33. Right, you've effectively put libm on the end of the command, as above.
  34.  
  35. mdw
  36.  
  37. -- 
  38. Matt Welsh     mdw@tc.cornell.edu     Cornell Theory Center
  39.   "Donuts. Is there anything they can't do?" 
  40.