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]

Problem with linking with --whole-program


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?

BR,
Henrik Mannerström


test1.h:
#ifndef test1_h
#define test1_h

class A {
 public:
  A();
  ~A();
};

extern A a;

#endif /* test1_h */

test1.cc:
#include "test1.h"

A::A() {}

A::~A() {}

prog.cc:
#include "test1.h"

A a;

int main() {
}


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