help-gplusplus
[Top][All Lists]
Advanced

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

Porting to g++ on Linux questions


From: Terry
Subject: Porting to g++ on Linux questions
Date: Thu, 31 Mar 2005 14:54:09 -0500

Hello, I am new to the list and am happy to see there is help available.

I have ported a large project from AIX to Sun, and now to Windows
sucessfully.  Now I am moving it to Linux.  However, I am having a couple of
problems that I did not see in the other environments.  My search for
answers has been fruitless.

First question:

Where do I find a list of built-in compiler defines that I can use in my
program for conditional compilations?

For example, I use constructs like:

#if defined(MSC)
        ....
#endif

Or
#if defined(_DEBUG)
        ...
#endif

Second, I am having a problem compiling some code.  Basically a base
template class includes a protected member variable which should be
available to the templated sub-class, but the compiler generates an error
that the member does not exist.

The example is shortened for clarity.

template <class T>
class ArcGnlTVIter
{
  // the following postfix operators are taken private to force
  // conformance with prefix operator on iterators.
              T*                operator++(int);
              T*                operator--(int);
public:
        ArcGnlTVIter() {mCurrentP = 0;}
virtual       T*                next()=0;
virtual       T*                prev();
virtual       void              rewind();

              T*                value() const          {return mCurrentP;}
                                operator T*() const    {return mCurrentP;}
              T*                operator++(/*prefix*/) {return next();}
              T*                operator--(/*prefix*/) {return prev();}
              ArcGnlTVIter<T>&  operator+=(ArcGnlIndex cnt);
              ArcGnlTVIter<T>&  operator-=(ArcGnlIndex cnt);
protected:
              T*                mCurrentP;
};

The subclass:

template <class T>
class ArcGnlTDListIter : public ArcGnlTVIter<T>
{
              ArcGnlIDListIter     anIter;
public:
        ArcGnlTDListIter() : anIter()   {}
        ArcGnlTDListIter(ArcGnlTDList<T>* listP) : anIter(listP) {}

              ArcGnlTDList<T>*     container() const    {return
(ArcGnlTDList<T>*) anIter.container();}
virtual       void                 rewind();
virtual       T*                   next();
virtual       T*                   prev();
friend class ArcGnlTDList<T>;
};

template <class T>
T*      ArcGnlTDListIter<T>::next()
{
  ArcGnlPtrDNode* resultP = (ArcGnlPtrDNode*) anIter.next();
  return mCurrentP = resultP ? (T*)resultP->aTValue : 0;

??????  Error happens on mCurrentP??????
}

I have even made this member public in the base class, to no avail.  What
gives?






reply via email to

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