delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/09/17/06:50:19

From: Radical DOT NetSurfer AT delorie DOT com
Newsgroups: comp.os.msdos.djgpp
Subject: Re: wont compile in DJGPP
Date: Mon, 17 Sep 2001 06:41:43 -0400
Organization: Posted via Supernews, http://www.supernews.com
Message-ID: <rmkbqts82mm3vm2t2hi8cd0lu115enar2d@4ax.com>
References: <9o2ij8$ak3ka$1 AT ID-72226 DOT news DOT dfncis DOT de>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
X-Complaints-To: newsabuse AT supernews DOT com
Lines: 71
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Just as an experiment to see what my installation of DJGPP 2.03
(GCC 2.95.3) would do, I tried, and got this output:

x.cpp: In function `int main(int, char **)':
x.cpp:11: `::numeric_limits' undeclared (first use here)
x.cpp:11: parse error before `char'
x.cpp:12: `::istreambuf_iterator' undeclared (first use here)
x.cpp:12: parse error before `>'
x.cpp:13: parse error before `>'
x.cpp:14: `it' undeclared (first use this function)
x.cpp:14: (Each undeclared identifier is reported only once
x.cpp:14: for each function it appears in.)
x.cpp:14: `end' undeclared (first use this function)
x.cpp:17: ANSI C++ forbids using pointer to a function in arithmetic
x.cpp:17: ANSI C++ forbids incrementing a pointer of type `vector<long
unsigned int,allocator<long unsigned int> > (*)(...)'
x.cpp:17: non-lvalue in increment
x.cpp:22: request for member `size' in `cs', which is of non-aggregate
type `vector<long unsigned int,allocator<long unsigned int> > ()(...)'
x.cpp:24: ANSI C++ forbids using pointer to a function in arithmetic
x.cpp:26: ANSI C++ forbids using pointer to a function in arithmetic

Is this what you are getting ?

more or less errors then above here?

Unfortunately, I am not familiar with 'std' stuff. I only compiled
this out of curiousity, like I said.  Maybe we'll both learn something
new.

On Sun, 16 Sep 2001 12:05:18 -0400, "Chris"
<anthropomorphic1 AT hotmail DOT com> wrote:

>
>can i have some help i cant seem to get this to compile in
>DJGPP
>
>#include <iostream>
>#include <algorithm>
>#include <vector>
>#include <fstream>
>#include <cstdlib>
>#include <limits>
>
>int  main()
>   {
>   std::ifstream in("dic.txt");
>   std::vector<std::size_t> cs(std::numeric_limits<unsigned char>::max());
>   std::istreambuf_iterator<char> it(in);
>   std::istreambuf_iterator<char> end;
>   while(it != end)
>      {
>      unsigned char ch=(unsigned char)*it++;
>      ++cs[ch];
>      }
>   in.close();
>   unsigned char pos='\0';
>   std::size_t icount = 0;
>   while(pos != cs.size())
>      {
>      if (cs[pos] > 0)
>      {
>         std::cout<<(char)pos<<": "<<cs[pos]<<", ";
>         if(++icount%5==0)
>            std::cout<<'\n';
>      }
>      ++pos;
>      }
>   std::cout<<"Goodbye"<<std::endl;
>   }

- Raw text -


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