www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/04/17/20:07:06

From: stadier AT cuug DOT ab DOT ca (Stadie Ralph)
Date: Mon, 17 Apr 1995 17:07:47 -0600
Apparently-To: djgpp AT sun DOT soe DOT clarkson DOT edu

I'm having a problem using abstract classes with GCC 2.6.3.  When I try to
compile and link the following program exerpt:

// =============================================================================

#include <iostream.h>

class Persistent {
protected:
    void ReadObject(void *buf, int len)
	{ cout << "Reading a buffer..." << endl; }
    void ReadObject(int &i)
	{ cout << "Reading an int..." << endl; ReadObject(&i, sizeof(int)); }
    virtual void Read() = 0;
};

class MyObject : public Persistent {
    int item;
    void Read()
	{ ReadObject(item); }
public:
    MyObject()
	{ Read(); }
    ~MyObject()
	{ }
    int Item()
	{ return item; }
};

int main(int argc, char **argv)
{
    MyObject m;

    return 0;
}

// =============================================================================

I get the error message:

	pure.cc(.text+0x7a): undefined reference to `__pure_virtual'

I can't seem to find any references to `__pure_virtual' (other than UNDEFINED)
in any of the DJGPP object libraries, so I don't know where it's expecting to
find it.  Is this a problem with my particular installation, or are pure
virtual functions not supported with this release of DJGPP?

Any suggestions, advice, hints or alternatives are appreciatively solicited.

Thanks,

Ralph

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019