On Wed, Feb 8, 2012 at 7:26 PM, Stephen D. Fox <stfo...@gmail.com> wrote: > In makefiles on Ubuntu & Debian machines, previously you could set > > CPPFLAGS=$(some paths) > LDFLAGS=$(some libraries) > > and > > "make main" > > would compile by default using something like this command: > > g++ $(CPPFLAGS) $(LDFLAGS) main.cpp -o main > > Now it gives linking errors because it seems g++-4.6 has changed (maybe > what was previously a bug?). Is it now compulsory for linking flags to > come after the > sources to which they apply?
That would be a question to ask on the gcc/g++ mailing lists. > I've tested with g++-4.4 and make 3.81-8 on ubuntu, and the above works, > but it > doesn't work with g++-4.6. Is there a different variable I could set > other than LDFLAGS > for a generic makefile like that? Yes, there's a different variable for that. In fact, there are two: $ make -f /dev/null -pq | grep -A2 '^%: %.cc' make: *** No targets. Stop. %: %.cc # recipe to execute (built-in): $(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@ $ I would recommend using LDLIBS. Philip Guenther _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make