help-make
[Top][All Lists]
Advanced

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

Re: Changes in g++-4.4 to g++-4.6 affecting make


From: Philip Guenther
Subject: Re: Changes in g++-4.4 to g++-4.6 affecting make
Date: Wed, 8 Feb 2012 21:04:50 -0800

On Wed, Feb 8, 2012 at 7:26 PM, Stephen D. Fox <address@hidden> 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



reply via email to

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