www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/04/06:39:05

Reply-To: <arfa AT clara DOT net>
From: "Arthur" <arfa AT clara DOT net>
To: "DJGPP Mailing List" <djgpp AT delorie DOT com>,
"Vadim Pokotilov" <vpoko AT earthlink DOT net>
Subject: RE: Libraries
Date: Fri, 4 Sep 1998 11:38:45 +0100
Message-ID: <000001bdd7f0$312d09c0$ca4e08c3@arthur>
MIME-Version: 1.0
In-reply-to: <6so094$m0d$1@birch.prod.itd.earthlink.net>
Importance: Normal

> When I get a lot of libraries in a source-only distribution and
> then compile
> them they end up having a .a extention (which isn't the problem). For
> example, the allegro library is liballeg.a
>
> Most makefiles do something like "gcc file.c -o file.exe -lalleg"
>
> When I run make it is unable to find the allegro library (which is in the
> same dir as the makefile) and gives me several link-time errors. I have to
> edit the makefille and change "-lalleg" to "liballeg.a" so it looks like
> "gcc file.c -o file.exe liballeg.o". THEN it compiles correctly
> (sometimes... sometimes it says "incorrect spacing in makefile"
> or something
> to that extent)
>
> Any ideas?

Libraries should be in the lib subdirectory. When you make Allegro, it
should place liballeg.a in that directory. To link with liballeg.a you need
to place -lalleg in your command line. This is because all libraries must
begin with lib and have the extender .a, so you just need to type the -l
followed by the library to link with.

Did you move liballeg.a from the lib folder? If so, put it back. If not,
you've got Allegro in the wrong place. The folder in which you extract
Allegro must be a subdirectory of your DJGPP directory (The Allegro
directory should be in the same place as the bin, include, lib etc.
directories).

What are the advantages of a libraries over object files? In a library, the
only things that are included are the commands and functions that you have
called from the library (or the library itself needs). If you look at your
program file which is linked with liballeg.o, you should find that it is
absolutely huge, due to the fact that you have linked with the entire
library.

HTH

James Arthur
jaa AT arfa DOT clara DOT net
ICQ#15054819

- Raw text -


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