Mail Archives: djgpp/2001/09/17/06:50:19
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 -