[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Library linking

From: Mark Galeck (CW)
Subject: RE: Library linking
Date: Sun, 2 Oct 2011 20:12:26 -0700

hello : -lhello hello.o
        gcc -o $@ $^

>However, this complains that it can't find "-lhello".

The GNU make manual in the Chapter "Introduction to Makefiles", section "How 
Make Works", explains that to process the target of a rule, make first 
recursively processes the prerequisites.  In your case "-lhello" is a 
prerequisite.  make tried to process it - since such a file did not exist and 
there was no rule with such a file as a target, make could not process it and 
bombed.  Rewrite your rules so that they use only real files (or possibly phony 
files, after you study them in the manual), that either exist or make knows how 
to make them recursively.  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]