Unsatisfied symbols for inline pure virtual overloads

Thomas Matelich matelich@gmail.com
Tue Aug 15 01:28:00 GMT 2006


I recently upgraded to gcc 4.1.1 on HP-UX 11i (hppa2.0w-hp-hpux11.11).
 I'm using the depots from the hp porting center.  I've already ported
this code to g++ 4.0.x on Linux, so I wasn't expecting any surprises.
So far things have gone pretty well except this one case that has
popped up a couple of times.  I haven't made a successful test case
yet, I thought I'd put this out and try to get it happening.

class Base
{
public:
   virtual int foo() const = 0;
};

class Derived
{
public:
   int foo() const { return f; }
private:
   int f;
};

I'm getting unsatisfied symbols on Derived::foo().  I've run into it
twice now in my source base.  I tried fixing it by adding a

void foo_dependent()
{
   Derived d;
   d.foo();
}

function to my .cpp file.  This didn't work.  One thing I just noticed
on my latest case is that this function isn't even called from the .o
that is complaining.  There is, however, another inline function in
Derived that is calling foo.  This is also happening the other case.

Oh, and I do have a pretty easy work around of moving the
implementation to the cpp file, I'd prefer not to.  I have a feeling
I'll hit this will happen more when I move into the rest of our source
base.

Thanks,
Tom



More information about the Gcc-help mailing list