Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!wuarchive!ukma!widener!dsinc!bagate!cbmvax!davidm From: davidm@cbmvax.commodore.com (David Miller - CATS) Newsgroups: comp.unix.amiga Subject: Re: Problem with gcc Message-ID: <21769@cbmvax.commodore.com> Date: 21 May 91 15:29:16 GMT References: <1991May19.144743.25904@nntp-server.caltech.edu> <1991May21.045217.19569@csusac.csus.edu> Reply-To: davidm@cbmvax.commodore.com (David Miller - The UNIX Guy) Organization: Commodore, West Chester, PA Lines: 41 Keywords: gcc unix library amiga In article <1991May19.144743.25904@nntp-server.caltech.edu> tll@nntp-server.caltech.edu (Tal Lewis Lancaster) writes: |After compiling all of my .c files using gcc, I get the following |message when it is trying to link: | |Undefined symbols First referenced in |---------------------------------------------- |select /usr/lib/libsocket.so |syslog /usr/lib/libsocket.so |seteuid /usr/lib/libsocket.so In article <1991May21.045217.19569@csusac.csus.edu> emmonsl@athena.ecs.csus.edu (L. Scott Emmons) writes: |The only way I could get socket stuff to work on my UX was to make sure that |/usr/ucb was in the path before /usr/ccs. Also you need to execute gcc |thusly: | | gcc -o file file.c -lsocket -lucb | ^^^^^^^^ ^^^^^ | |/usr/ucb/ld will complain about some library (libsocket.so, I think) being |included twice, but it will work ok. | |Strangely 'nuff, if you want to compile&link programs which don't use sockets |and BSD stuff, /usr/ucb must _not_ be in the path before /usr/ccs...very,very |strange behavior! By default, gcc and cc will use the System V include files and libraries. To compile BSD programs, you need to do the following: [g]cc -I/usr/ucbinclude -L/usr/ucblib -o file file.c -lsocket -lucb This tells the preprocessor to look for include files in /usr/ucbinclude before trying /usr/include and tells the linker to look for libraries in /usr/ucblib. DavidM -- DavidM CATS - Commodore Applications and Technical Support +1 215 431 9425 davidm@cbmvax.commodore.com "Commodore Amiga 3000UX - Born to Run UNIX SVR4"