www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/08/19:26:41

Xref: news2.mv.net comp.os.msdos.djgpp:4732
From: Shawn Hargreaves <slh100 AT york DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: dumb newbie question: make and allegro library...
Date: Sat, 8 Jun 1996 21:36:55 +0100
Organization: The University of York, UK
Lines: 32
Message-ID: <Pine.SGI.3.91.960608211036.11369C-100000@tower.york.ac.uk>
NNTP-Posting-Host: tower.york.ac.uk
Mime-Version: 1.0
In-Reply-To: <31b99e4d.3562626@nntp.ix.netcom.com>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

> FLAGS = ../lib/liballeg.a -liostream
> 
> dots : colors.cpp
> 	gcc $(FLAGS) colors.cpp

References to libraries have to come after the source file they are 
using. This is because ld is a single-pass linker, so it looks first at 
the libraries but ignores them because it doesn't have any unresolved 
symbols. Then it comes to the colors.o file which uses lots of symbols, 
but by this time it is too late to go back and get them from the library :-)

Try something like:

CFLAGS = -O -Wall etc.
LIBS = ../lib/liballeg.a -liostream

dots : colors.cpp
	gcc $(CFLAGS) colors.cpp $(LIBS)

> Points of note:  allegro.h is currently contained in ../allegro,
> ../include, and the current directory. The allegro directory is even

It is liballeg.a that it wasn't finding, not allegro.h. If it couldn't 
find the header, it wouldn't get as far as the linker...


/*
 *	Shawn Hargreaves.        Why is 'phonetic' spelt with a ph?
 *	Check out Allegro and FED on http://www.york.ac.uk/~slh100/
 */


- Raw text -


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