This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with linking with --whole-program


On 12/14/2012 11:11 AM, Henrik Mannerström wrote:
Hello,

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.

--
Florian Weimer / Red Hat Product Security Team


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]