Compilation error

Hi,

My original code was on Forte Developer 7 (Solaris 9) .

Now I am compiling the code on Sun Studio 11 (Solaris 9).

But I am getting "The base must be a previously defined class or struct" error.

Here is a part of my header file :

///my .h file

#include <exception>

.........

.........

.........

#define PRECOND(cond,exception)KMS_ASSERT_MSG_XCPT((cond)&&isInvariant(),"Precondition failure",(exception))

.......

.......

.......

class assertion_fail{};

template <typename E> class AssertionFail : public E,public assertion_fail

{

public:

AssertionFail(const E&e):E(e){};

};

.............

.............

Here is part of my .cxx file

.............

.............

template <class RequestType>

kmsTypes::TIdentifier

TSingletonRequestList<RequestType>::add(RequestType* req) throw (Duplicate)

{

PRECOND(0 != req, "null RequestType");

AUTO_LOCK(_mutex);

return _add(req);

}

.....................

.....................

The function add is being called in another .cxx file.

When I compile the code using make, I am getting the following error:

"./kmsAssert.h", line 90: Error: The base "E" must be a previously defined class or struct.

"./abc.cxx", line 64:Where: While specializing "AssertionFail<char[17]>".

"./abc.cxx", line 64:Where: Instantiated from TSingletonRequestList<DownlinkRequest>::add(DownlinkRequest*).

__

I really don't know why I am getting this compilation error. Can anybody please help me ?

Message was edited by:

RameshACSTS

[1762 byte] By [RameshACSTS] at [2007-11-26 8:14:40]
# 1

The error message should be self-explanatory: Template AssertionFail is being instantiated with a template parameter that is not defined as a class or struct.

Some possibilities:

- the template argument is not a class or struct.

- the template argument is a class or struct, but has only a forward-declaration.

You don't show the code that creates the instance, so I can't be more specific.

Maybe you can post an example that could be compiled to show the error message.

clamage45 at 2007-7-6 21:11:09 > top of Java-index,Development Tools,Solaris and Linux Development Tools...