This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Nested class definitions/templates/repo
- To: help-g++ at prep dot ai dot mit dot edu, egcs at cygnus dot com
- Subject: Nested class definitions/templates/repo
- From: Michael Ben-Gershon <mybg at netvision dot net dot il>
- Date: Thu, 05 Mar 1998 16:29:57 +0200
- Organization: My Office
Are there any known limitations of egcs-1.0.1 in terms of nested
class definitions and templates when using -frepo, or have I made
some stupid mistake?
Without giving all of the details here, as it is quite an elaborate
system, I am getting link errors of the form
'undefined reference to `Counters<int>::COUNTED::start_code(void)'
in a function which inherits from Counters<int>::COUNTED.
Don't ask WHY the system is so complex - it is designed for
automatic translation from a higher level specification.
All of the various files compile OK, but it is at link time that
they fall down.
I get a number of such errors, all referring to
Counters<int>::COUNTED::some_function()
If I redesign the system to consist of everything in one object
file I can get it to work, but that requires messing about with
the header files in a manner which makes it difficult to maintain.
If anyone is able to help, I would be most grateful.
The outline is as follows (from the top level, downwards):
... file SJN.hh ..
#include "Counters.hh"
class ShortestJobNext
{
public:
class JOB : public Counters<int>::COUNTED
{
public:
void start_code(int length)
{ Counters<int>::COUNTED::start_code(length); ... }
};
};
... file Counters.hh ...
#include sync_support.hh"
template <class T>
class Counters
{
public:
class COUNTED : public sync_method_1<T>
{
public:
void start_code() { ...};
};
};
... file sync_support.hh ...
template <class T>
class sync_method_1 : public basic_sync_method
{
... nothing relevant here ...
};
class basic_sync_method
{
public:
basic_sync_method();
protected:
virtual void start_code() {};
};
Michael Ben-Gershon
mybg@netvision.net.il