<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Use of &#x27;count&#x27; is ambiguous]]></title><description><![CDATA[<p>Hallo zäme,</p>
<p>ich habe eine globale Variable vom Typ Integer definiert. Wenn ich darauf zugreifen möchte, erhalte ich die Fehlermeldung:<br />
Use of 'count' is ambiguous</p>
<p>Nachfolgend der davon betroffene Code:</p>
<p>#include &lt;stdlib.h&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;cstring&gt; // strlen<br />
#include &lt;string&gt;<br />
using namespace std;</p>
<p>struct element<br />
{<br />
int value;<br />
element *next; // address of next number in the stack<br />
};<br />
element *anchor; // first element of the list<br />
element *first;<br />
int count; // amount of numbers stored in the list</p>
<p>void init() {<br />
count=0;<br />
anchor = 0;<br />
}</p>
<p>Die Methode init() wird aus der main Methode aufgerufen.</p>
<p>Habt Ihr eine Idee?</p>
<p>Gruss &amp; danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/253541/use-of-count-is-ambiguous</link><generator>RSS for Node</generator><lastBuildDate>Sun, 13 Sep 2026 16:48:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/253541.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 03 Nov 2009 20:46:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Use of &#x27;count&#x27; is ambiguous on Tue, 03 Nov 2009 20:46:49 GMT]]></title><description><![CDATA[<p>Hallo zäme,</p>
<p>ich habe eine globale Variable vom Typ Integer definiert. Wenn ich darauf zugreifen möchte, erhalte ich die Fehlermeldung:<br />
Use of 'count' is ambiguous</p>
<p>Nachfolgend der davon betroffene Code:</p>
<p>#include &lt;stdlib.h&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;cstring&gt; // strlen<br />
#include &lt;string&gt;<br />
using namespace std;</p>
<p>struct element<br />
{<br />
int value;<br />
element *next; // address of next number in the stack<br />
};<br />
element *anchor; // first element of the list<br />
element *first;<br />
int count; // amount of numbers stored in the list</p>
<p>void init() {<br />
count=0;<br />
anchor = 0;<br />
}</p>
<p>Die Methode init() wird aus der main Methode aufgerufen.</p>
<p>Habt Ihr eine Idee?</p>
<p>Gruss &amp; danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1802897</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1802897</guid><dc:creator><![CDATA[proxteam]]></dc:creator><pubDate>Tue, 03 Nov 2009 20:46:49 GMT</pubDate></item><item><title><![CDATA[Reply to Use of &#x27;count&#x27; is ambiguous on Tue, 03 Nov 2009 20:54:18 GMT]]></title><description><![CDATA[<p>proxteam schrieb:</p>
<blockquote>
<p>Hallo zäme</p>
</blockquote>
<p>Schweizer? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>proxteam schrieb:</p>
<blockquote>
<p>ich habe eine globale Variable vom Typ Integer definiert. Wenn ich darauf zugreifen möchte, erhalte ich die Fehlermeldung:<br />
Use of 'count' is ambiguous</p>
</blockquote>
<p>Da gibts wahrscheinlich ein Problem mit der Funktion <code>std::count()</code> in der Standardbibliothek. Eventuell wird der Header <code>&lt;algorithm&gt;</code> irgendwo versteckt eingebunden (möglicherweise in <code>&lt;string&gt;</code> ). Dadurch, dass du <code>using namespace std;</code> verwendest, fällt das in den globalen Namensraum - wie deine Variable. Somit hast du mehrdeutige Bezeichner.</p>
<p>Hier siehst du einen Grund, wieso man mit <code>using namespace</code> sparsam umgehen sollte. Lasse diese Zeile weg und schreibe vor Standardtypen <code>std::</code> , also beispielsweise <code>std::cout</code> und <code>std::string</code> .</p>
<p>Im Weiteren ist die Headerdatei <code>&lt;stdlib.h&gt;</code> nicht ganz korrekt, besser wäre <code>&lt;cstdlib&gt;</code> (C++-Standardheader haben nie eine Dateiendung). Aber wenn du deren Funktionalität nicht benötigst, kannst du die Datei auch weglassen. Es wäre auch gut, wenn du in Zukunft [cpp]-Tags verwenden könntest (erste weisse Schaltfläche), damit wird der Code schön bunt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1802898</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1802898</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Tue, 03 Nov 2009 20:54:18 GMT</pubDate></item><item><title><![CDATA[Reply to Use of &#x27;count&#x27; is ambiguous on Tue, 03 Nov 2009 20:56:13 GMT]]></title><description><![CDATA[<p>Noch einen kleinen Tipp fürs Forum:</p>
<p>Wir haben hier cpp-Tags: (gleich unter dem Smileys)</p>
<pre><code class="language-cpp">#include &lt;stdlib.h&gt;
#include &lt;iostream&gt;
#include &lt;cstring&gt; // strlen
#include &lt;string&gt;
using namespace std;

struct element
{
  int value;
  element *next; // address of next number in the stack

  element *anchor; // first element of the list
  element *first;
  int count; // amount of numbers stored in the list

  void init() {
  count=0;
  anchor = 0;
  }
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1802899</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1802899</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Tue, 03 Nov 2009 20:56:13 GMT</pubDate></item><item><title><![CDATA[Reply to Use of &#x27;count&#x27; is ambiguous on Tue, 03 Nov 2009 21:22:41 GMT]]></title><description><![CDATA[<p>Vielen Dank! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /> Es funktioniert bestens und danke für den Tipp des Syntaxhighlightings.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1802916</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1802916</guid><dc:creator><![CDATA[proxteam]]></dc:creator><pubDate>Tue, 03 Nov 2009 21:22:41 GMT</pubDate></item></channel></rss>