delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/04/15:14:23

From: Roland Ortloff <r DOT ortloff AT gmx DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Basic problem? 'endl' is already declared in this scope
Date: Mon, 04 Oct 1999 16:04:03 +0200
Organization: DC AG
Lines: 147
Message-ID: <37F8B3D3.A6FBCFA5@gmx.de>
NNTP-Posting-Host: saturn.dbft.daimlerbenz.com
Mime-Version: 1.0
X-Trace: news.sns-felb.debis.de 939045686 5989 53.122.79.11 (4 Oct 1999 14:01:26 GMT)
X-Complaints-To: news AT sns-felb DOT debis DOT de
NNTP-Posting-Date: 4 Oct 1999 14:01:26 GMT
X-Mailer: Mozilla 4.6 [de] (WinNT; I)
X-Accept-Language: de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi all,

I'm really depressed because something doesn't
work which actually should in my opinion:

Compiling following code under Windows 96
(djgpp gcc V2.95, stlport V3.2.1) with
gcc -Ic:/djgpp/stlport -c iotest.cpp I get the
following error message:

In file included from iotest.cpp:49:
c:/djgpp/stlport/iostream:76: `endl' is already declared in this scope
c:/djgpp/stlport/iostream:77: `ends' is already declared in this scope
c:/djgpp/stlport/iostream:80: `flush' is already declared in this scope


It seems that both iostreams are used,
the regular one and the one from stlport.
Using namespace stlport doesn't help.
What am I doing wrong. I'm new to that all
so I'd be happy about any help.

Thank you very much.

Roland

--- cut here ---

typedef signed long  TLongitude;
typedef signed long  TLatitude;
typedef signed short TAltitude;


// Invalid coordinates to determine if coordinate is valid
const TLongitude INVALID_LONGITUDE = -2147483647;
const TLatitude  INVALID_LATITUDE  = -2147483647;
const TAltitude  INVALID_ALTITUDE  =          -1;



class CCoordinate
{
public:
  // LIFECYCLE
  CCoordinate();
  CCoordinate(const TLongitude Longitude, 
              const TLatitude  Latitude, 
              const TAltitude  Altitude);
  virtual ~CCoordinate();

  // OPERATIONS                       
  // ACCESS (Attribute Accessors)
  TLongitude GetLongitude() const;
  TLatitude  GetLatitude () const;
  TAltitude  GetAltitude () const;

protected:

private:
  struct SCoordAttr
  {
    TLongitude Longitude; 
    TLatitude  Latitude;
    TAltitude  Altitude;
  };

  SCoordAttr mCoordAttr;
};




#include <iostream>

using namespace stlport;


//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

// LIFECYCLE
// Konstruktor
CCoordinate::CCoordinate()
{
  // No coordinates are given, use invalid ones
  mCoordAttr.Longitude = INVALID_LONGITUDE;
  mCoordAttr.Latitude  = INVALID_LATITUDE;
  mCoordAttr.Altitude  = INVALID_ALTITUDE;
}


// Konstruktor
CCoordinate::CCoordinate(const TLongitude Longitude, 
                         const TLatitude  Latitude, 
                         const TAltitude  Altitude)
{
  mCoordAttr.Longitude = Longitude;
  mCoordAttr.Latitude  = Latitude;
  mCoordAttr.Altitude  = Altitude;
}


// // OPERATORS
// Operator overloading: Output-Method for CCoordinate
ostream& 
operator<<(ostream& os, const CCoordinate &Coordinate)
{
  os << "(" 
     << Coordinate.GetLongitude() << ", " 
     << Coordinate.GetLatitude()  << ", " 
     << Coordinate.GetAltitude()  << ")";

  return os;
}


// Destruktor
CCoordinate::~CCoordinate()
{
}


// ACCESS (Attribute Accessors)
// Return Longitude
TLongitude
CCoordinate::GetLongitude() const
{
  return mCoordAttr.Longitude;
}


// Return Latitude
TLatitude  
CCoordinate::GetLatitude() const
{
  return mCoordAttr.Latitude;
}


// Return Altitude
TAltitude 
CCoordinate::GetAltitude() const
{
  return mCoordAttr.Altitude;
}
--- cut here ---

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019