This is a source I downloaded off the Internet, and the author explicitly stated that it would compile on Linux and OS X. Well, he's only half right. It compiles on OS X, but not on Linux.

Well, here's the offending line of code:

Code:
template<class T>
class SmartPointer
{
 protected:
  T* p;
 public:
  SmartPointer(T* _p=0) 
    : p(_p) {}
  inline T&operator*() const 
    {return *p;}
  inline T*operator->() const 
    {return p;}
  inline operator const bool() const 
    {return p!=0;}
  inline T*ptr() const
    { return p; }
};

.....

template <class T> 
class DELP : public SmartPointer<T>
{
 private:
  DELP(const DELP<T> &x);
 public:
  const DELP<T> &operator=(DELP<T> &x)
  {
    delete p;           // FIRST ERROR of "p" was not declared in this scope
    p=x.p;x.p=0;
    return *this;
  }

  ~DELP()
    { delete p;p=0;} // SECOND ERROR of "p" was not declared in this scope
  DELP(T*_p=0) 
    : SmartPointer<T>(_p) {}
  void set(T*_p)
    {
      delete p;       // THIRD ERROR of "p" was not declared in this scope
      p=_p;
    }

......
Could somebody tell me why this is throwing an error on Linux but not on OS X?

I'm using g++ 4.0.3 and the make command for this particular section seems to be
Code:
g++   -Wall -W -Wno-deprecated -O2 -DNDEBUG -DWORDINDEX_WITH_4_BYTE  -c Parameter.cc -o optimized/Parameter.o
Thanks.