delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/02/06:47:09

From: av568 AT rgfn DOT epcc DOT edu (Beautiful Savior Lutheran Church)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Can't link non standard library. FAQ not enough.
Date: 2 Apr 1997 06:36:38 GMT
Organization: The Rio Grande Free-Net, El Paso Community College, El Paso, TX
Lines: 42
Message-ID: <5hsupm$iis@news.epcc.edu>
References: <01bc3ec5$8456ed20$86e04cc3 AT 10 DOT 0 DOT 1 DOT 1 DOT inf> <334156A0 DOT 2FD AT iname DOT com>
NNTP-Posting-Host: rgfn.epcc.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Skye (s_c AT geocities DOT com) wrote:
> Jordi Vida=F1a Caball=E9 wrote:

> > When trying
> > to link, ld says "no such file or directory (ENOENT)". I've written the=

> > library name
> > with suffix .a, without it, with and without the path before it's name =
> and =

> =2E.......

> Here's an example of what works for me (in c++):

> the lib is: libtest.h, libtest.cc

> gcc -c libtest.cc -o libtest.a

> [copy libtest.a file to djgpp\lib dir]

> the program is: prog.cc [includes libtest.h]

> gcc -c prog.cc -o prog.o
> gxx -o prog.exe prog.o -ltest
> [run prog.exe and it should work]


> Name your lib:
> "lib"[your name]".a"

> It works for me but I don't know why yet.? Eli? DJ?

This method works, but only with a single-file. Your "library file" is 
simply an object file that gets linked with the program. For a true 
library consiting of multiple object files, use the 'ar' command. To 
figure out how:

info ar

--
Beautiful Savior Evangelical Lutheran Church - av568 AT rgfn DOT epcc DOT edu
We have what you need-- A Savior!

- Raw text -


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