From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,d3f1be53c9ffa934 X-Google-Attributes: gidfee84,public From: simon.j.wright@gecm.com (Simon Wright) Subject: Re: How to link a library file Date: 1996/06/04 Message-ID: #1/1 X-Deja-AN: 158453914 references: <4ofqqd$alm@alpha.comsource.net> <4oi7d8$rle@glitnir.ifi.uio.no> organization: Ferranti Naval Systems, GEC-Marconi S3I Combat Systems Division newsgroups: comp.unix.osf.osf1 In article <4oi7d8$rle@glitnir.ifi.uio.no> torstenk@ifi.uio.no (Torsten Robert Kirschner) writes: > >>>>> "DP" == David Phan writes: > In article <4ofqqd$alm@alpha.comsource.net> dphan@alpha.comsource.net (David Phan) writes: > DP> I tried to link the library file /usr/local/sql/lib/libsql.a to a > DP> C program myprog.c with the following command and got error messages: > DP> cc /usr/local/sql/lib/libsql.a myprog.c > > I'd suggest: > > cc -L/usr/local/sql/lib -lsql myprog.c > > In general, a look at cc's man page might be a good idea. Also, if you > need header files, you might have to add a -I/usr/local/sql/include. True-ish. Your version should be cc myprog.c -L/usr/local/sql/lib -lsql David's version should be cc myprog.c /usr/local/sql/lib/libsql.a (the linker doesn't know what it needs from libsql.a until it's read myprog.o). -- Simon Wright (G-net) +842-1778 Ferranti Naval Systems (voice) +44(0)1705-701778 GEC-Marconi S3I Combat Systems Division (fax) +44(0)1705-701800