help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

g++ 4.1.x compile error with template


From: agarkar
Subject: g++ 4.1.x compile error with template
Date: 29 May 2006 08:08:42 -0700
User-agent: G2/0.2

Hi,
I am not able to compile this with gcc4.x , it works fine with
gcc3.2.2.
When I include txbase.h in .C file and build
g++ -c filename.C
I get following error. Line 56 is List <TxRule *>   commonValidations;
in txbase.h
Based on my reading I will need to add a line in txbase.h to define
List class, But I am not able to get correct signature
what will make gcc happy.
/home/eps/eps_port/te/src/EGIFT/TxFrm/TxInc/txbase.h:56: error: ISO C++
forbids declaration of 'List' with no type
/home/eps/eps_port/te/src/EGIFT/TxFrm/TxInc/txbase.h:56: error:
expected ';' before '<' token
/home/eps/eps_port/te/src/EGIFT/TxFrm/TxInc/txbase.h:57: error:
'List' has not been declared
/home/eps/eps_port/te/src/EGIFT/TxFrm/TxInc/txbase.h:57: error:
expected ',' or '...' before '<' token

Thanks in advance.
Shailesh


//File List.h
template <class Item>
struct ListItem {
        Item            felement ;
        struct ListItem<Item>   *fnext ;
        ListItem(const Item& element) : felement(element),
                                        fnext((ListItem *)0) {}
};


template <class Item> class ListIterator;

template <class Item>

class List  {

friend class ListIterator<Item>;
public :
        List() :        head (0),
                        tail (0) {

.....
private :
        ListItem<Item> * head;
        ListItem<Item> * tail;
        int fcount;

} ;


template <class Item>
List<Item>::~List()
{
        ......delete prev ;
        }
}


//txbase.h

#include <TxFrm/TxInc/txdefs.h>
#include <TxFrm/TxInc/vtxbase.h>
#include <TxFrm/TxInc/TxContext.h>
#include <TxFrm/TxInc/txrule.h>
#include <TEInc/List.h>

// The Transaction Base class for all types of Transactions
class Tx:public vTxBase
{
public:
        ........
protected:
        TxContext *       pCntx;
        List <TxRule *>   commonValidations;
        void RemoveRules(List<TxRule *> & ruleList);
        // Outside users are not expected to call this.
        virtual bool      Log() = 0;
};



reply via email to

[Prev in Thread] Current Thread [Next in Thread]