This is the mail archive of the
mailing list for the GCC project.
Re: Problem with linking with --whole-program
- From: Henrik Mannerström <henrik dot mannerstrom at gmail dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 14 Dec 2012 13:14:09 +0200
- Subject: Re: Problem with linking with --whole-program
- References: <50CAFB3C.firstname.lastname@example.org> <50CAFFC0.email@example.com>
Ok, thank you! I had misunderstood the whole-program option. I think the
-flto was added in gcc 4.5 so I will just have to go without it.
On 12/14/2012 12:30 PM, Florian Weimer wrote:
> On 12/14/2012 11:11 AM, Henrik Mannerström wrote:
>> My program won't link when I add the '--whole-program' option with gcc
>> 4.4.6. It compiles fine with 'g++ -o prog prog.cc test1.cc', but reports
>> prog.cc:3: undefined reference to `A::A()'
>> prog.cc:3: undefined reference to `A::~A()'
>> with 'g++ --whole-program -g -o prog prog.cc test1.cc'
>> Is this a c++ issue or something with gcc?
> --whole-program itself does not cause the compiler to combine
> translation units. Both input files are compiled separately and flat
> out violate the assumptions of --whole-program.
> Try passing -flto as well.