www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/18/11:16:13

Newsgroups: comp.os.msdos.djgpp
From: Elliott Oti <oti AT phys DOT uu DOT nl>
Subject: Re: To link or not to link???
Sender: usenet AT phys DOT uu DOT nl (News system Tijgertje)
Message-ID: <Pine.OSF.4.03.9809181644380.5924-100000@ruunf0.phys.uu.nl>
In-Reply-To: <19980918102348.06541.00001052@ng74.aol.com>
Date: Fri, 18 Sep 1998 14:48:55 GMT
References: <19980918102348 DOT 06541 DOT 00001052 AT ng74 DOT aol DOT com>
Mime-Version: 1.0
Organization: Physics and Astronomy, University of Utrecht, The Netherlands
Lines: 27
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On 18 Sep 1998, Uhfgood wrote:

> 
> Okay i'm gonna ask this... since I can take an *.o file and use gcc to create
> an *.exe out of it, can I also specifiy libraries to link in at the gcc command
> line or do I *have* to use LD.EXE?                                     Thanks  
> -KWII-

Yes. If libfoo.a is in the current working directory
   gcc bar.c libfoo.a -o bar.exe will link in libfoo.a
If libfoo.a is in one of the directories listed in djgpp.env, 
   gcc bar.c -lfoo -o bar.exe will link in libfoo.a also.
If libfoo.a is in another directory, say c:\fubar
   gcc bar.c c:/fubar/libfoo.a -o bar.exe
or
   gcc -Lc:/fubar bar.c -lfoo -o bar.exe
will work as well.

This is probably in the FAQ as well.

Cheers,
  Elliott Oti
  http://www.fys.ruu.nl/~oti
  "Q: What did the elephant say to the naked man?
   A: It's cute but can you pick up peanuts with it?"


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019