delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/09/18/10:29:21

From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help in my codes.
Date: 16 Sep 2002 11:08:55 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 33
Message-ID: <am4e47$oql$1@nets3.rz.RWTH-Aachen.DE>
References: <am3jv2$vbr$1 AT reader01 DOT singnet DOT com DOT sg>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 1032174535 25429 137.226.32.75 (16 Sep 2002 11:08:55 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 16 Sep 2002 11:08:55 GMT
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Kim Seng <Query AT singnet DOT com DOT sg> wrote:

> program13.cc:14: use of `count' is ambiguous
> program13.cc:7:   first declared as `int count' here
> c:/djgpp/lang/cxx-v3/bits/stl_algo.h:320:   also declared as `typename
>    std::iterator_traits<_Iterator>::difference_type std::count(_InputIter,
>    _InputIter, const _Tp&)' here

I haven't even seen your code (don't UUencode source code, please...),
but IMHO the error message is quite self-explanatory even so.  Your
program contains an error.  It uses two things that conflict with each
other:

1) a variable declared

	int count;

2) the statement

	using std;

There obviously is an object 'std::count' in the STL headers. The
'using std' pulls that into your program's namespace, where it
collides with your variable named the same.

Solution: rename your variable, or get rid of that "using std".

Better solution: get a an up-to-date C++ textbook that works with the
final standardized language, not some outdated predecessor of it.

-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


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