www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/09/08:11:43

From: fredex AT fcshome DOT stoneham DOT ma DOT us
Message-Id: <199606091143.HAA00578@fcshome.stoneham.ma.us>
Subject: Re: dumb newbie question: make and allegro library...
To: baren AT ix DOT netcom DOT com (The Great and Powerful Marcus)
Date: Sun, 9 Jun 1996 07:43:17 -0400 (EDT)
Cc: djgpp AT delorie DOT com
In-Reply-To: <31b99e4d.3562626@nntp.ix.netcom.com> from "The Great and Powerful Marcus" at Jun 8, 96 03:59:58 pm

Thinking furiously, The Great and Powerful Marcus wrote:
> 
> FLAGS = ../lib/liballeg.a -liostream
> 
> vpath %*.h ../include
> 
> dots : colors.cpp
> 	gcc $(FLAGS) colors.cpp
> 
> Yes, there is only one file. Anyway, the make program runs up to the
> ld stage, then spews out about 100 references to undefined functions,
> all of which come from the allegro library.
> 

Did you try it this way?

 	gcc colors.cpp $(FLAGS)

since these are unix-derived tools, and Unix tools expect the library
flags to be AT THE END of the command line (since most linkers are
single-pass linkers), you should try it this way.

Otherwise, you've told it to examine the  allegro library BEFORE you
told it to compile colors.cpp, so when it examines the lib, it finds no
items which it needs to extract to satisfy any (at that time) undefined
references, then it compiles the colors.cpp, links in the system
library, runs out of things to link, then discovers a bunch of
unresolved references.

Doing it the other way "accumulates" all the unresolved references
first, then satisfies them by adding in the library.

Fred
-- 
-------------------------------------------------------------------------------
 .----    Fred Smith    /                        Office: fred AT computrition DOT com 
( /__  ,__.   __   __ /  __   : /                                 508-663-2524 
 /    /  /   /__) /  /  /__) .+'           Home: fredex AT fcshome DOT stoneham DOT ma DOT us 
/    /  (__ (___ (__(_ (___ / :__                                 617-438-5471 
-------------------------------- Jude 1:24,25 ---------------------------------

- Raw text -


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