home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.linux
- Path: sparky!uunet!spool.mu.edu!caen!batcomputer!db.TC.Cornell.EDU!mdw
- From: mdw@db.TC.Cornell.EDU (Matt Welsh)
- Subject: Re: gcc 2.3.3 problem
- Message-ID: <1993Jan26.002313.6776@tc.cornell.edu>
- Sender: news@tc.cornell.edu
- Nntp-Posting-Host: db.tc.cornell.edu
- Organization: Linux
- References: <1993Jan25.144702.4734@hp9000.csc.cuhk.hk>
- Date: Tue, 26 Jan 1993 00:23:13 GMT
- Lines: 27
-
- In article <1993Jan25.144702.4734@hp9000.csc.cuhk.hk> a080700@hp9000.csc.cuhk.hk (Stephen Wong S M) writes:
- >I'm using linux 0.99pl4/SLS 1.0/gcc 2.3.3/lib 4.2 and I test the
- >gcc compiler with the following program:-
- [Program deleted]
- >
- >I use the following command line to compile:-
- >gcc -lm -o test_sqrt test_sqrt.c
- >
- >but I got the following error message:-
- >/usr/tmp/cca001331.o: Undefined symbot _sqrt referenced from text segment
-
- No, it's not a bug in the compiler. The order of .o's, .c's, and -l or .a's
- matters. Try the command
- gcc -o test_sqrt test_sqrt.c -lm
- (note new placement of -lm switch).
-
- >Then I tried another command line:-
- >gcc -o test_sqrt test_sqrt.c /usr/lib/libm.a
- >and succeed.
-
- Right, you've effectively put libm on the end of the command, as above.
-
- mdw
-
- --
- Matt Welsh mdw@tc.cornell.edu Cornell Theory Center
- "Donuts. Is there anything they can't do?"
-