cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/14/22:12:12

Newsgroups: comp.os.msdos.djgpp
Subject: Need Help Getting Started with STL
From: saint AT phoenix DOT net (Randy Saint)
X-Newsreader: WinVN 0.99.8 (x86 32bit)
MIME-Version: 1.0
Lines: 50
Message-ID: <uyLx2.7846$lx.3834@news2.giganews.com>
NNTP-Posting-Date: Sun, 14 Feb 1999 20:23:22 CDT
X-Trace: sv1-VeSEY4Dhwzt+pAbRep8uHTwtI4DxUKdJi2soSFUQJqrDU4oboo5v18PJdrvMRqZeXnydWNZ7BQ3PO9C!EYhR8mOM7Z0=
X-Complaints-To: abuse AT GigaNews DOT Com
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
Date: Mon, 15 Feb 1999 02:23:22 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm having some difficulty getting started with the STL that comes with DJGPP.
It sure would help to have some examples, ones that demonstrated the entire 
file to show what files are included, etc.

Just for starters, I tried this example from ObjectSpace example set.  I 
figure that the syntax of the STLs may differ, but I get a bunch of compile 
errors in header files.  I don't know where to start looking.
Here is the code:

#include <stl.h>
#include <iostream.h>

int main ()
{
  vector <int> v (5);
  for (int i = 0; i < v.size (); i++)
    v[i] = i + 1;
  int sum = accumulate (v.begin (), v.end (), 0);
  cout << "sum = " << sum << endl;
  return 0;
}

That's it.  And the compile command line is:
gcc -Wall -g -o accum1.exe accum1.cpp
And the error messages generated are:

In file included from c:/djgpp/lang/cxx/stl_config.h:106,
                 from c:/djgpp/lang/cxx/stlalgobase.h:36,
                 from c:/djgpp/lang/cxx/algorithm:30,
                 from c:/djgpp/lang/cxx/stl.h:4,
                 from accum1.cpp:1:
c:/djgpp/lang/cxx/_G_config.h:20: parse error before `__extension__'
In file included from c:/djgpp/lang/cxx/stlalgobase.h:45,
                 from c:/djgpp/lang/cxx/algorithm:30,
                 from c:/djgpp/lang/cxx/stl.h:4,
                 from accum1.cpp:1:
c:/djgpp/lang/cxx/type_traits.h:93: parse error before `>'
c:/djgpp/lang/cxx/type_traits.h:99: parse error before `}'
...

'til the compiler quits.

I recently upgraded to version 2.8.1.  
Am I including the wrong files, using improper syntax for the vector class, 
leaving something out of the compile statement, or what?

Thanks, in advance,
Randy


- Raw text -


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