<?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[3 C:&#x5C;Dev-Cpp&#x5C;Unbenannt2.cpp &#96;cout&#x27; undeclared (first use this function)]]></title><description><![CDATA[<p>Hi</p>
<p>Habe mit C++ angefangen und bin dabei mit dem Bjarne Stroustroup-Buch zu lernen.<br />
Allerdings habe ich Probleme mit dem kompilieren einfachster Programme...</p>
<p>Habe folgenden Quellcode aus dem Buch einfach mal &quot;abgeschrieben&quot;:</p>
<pre><code>bool accept()
{
     cout &lt;&lt; &quot;Moechten Sie weitermachen (j oder n)?\n&quot;; // stelle Frage

     char antwort = 0;
     cin &gt;&gt; antwort;
     if (antwort == `j`) return true;
     return false;
}
bool accept2()
{
     cout &lt;&lt; &quot;Möchten Sie weitermachen (j oder n)?\n&quot;;

     char antwort = 0;
     cin &gt;&gt; antwort;

     switch (antwort) {
            case `j`:
                 return true;
            case `n`:
                 return false;
            default:
cout &lt;&lt; &quot;Ich halte das fuer ein Nein.\n&quot;;
return false;
}
}
bool accept3()
{
     int versuche = 1;
     while (versuche &lt; 4) {
           cout &lt;&lt; &quot;Moechten Sie weitermachen (j oder n)?\n&quot;;
           char antwort = 0;
           cin &gt;&gt; antwort;

           switch (antwort) {
                  case `j`:
                       return true
                  case `n`:
                       return false;
                  default:
                          cout &lt;&lt; &quot;Ich verstehe Sie leider nicht.\n&quot;;
                          versuche = versuche + 1;
                          }
                          }
                          cout &lt;&lt; &quot;Ich halte das für ein Nein.\n&quot;;
                          return false;
                          }
</code></pre>
<p>und bekomme beim kompilieren folgende Fehlermeldung:</p>
<p>C:\Dev-Cpp\Unbenannt2.cpp In function <code>bool accept()': 3 C:\\Dev-Cpp\\Unbenannt2.cpp</code>cout' undeclared (first use this function)<br />
(Each undeclared identifier is reported only once for each function it appears in.)<br />
6 C:\Dev-Cpp\Unbenannt2.cpp <code>cin' undeclared (first use this function) 7 C:\\Dev-Cpp\\Unbenannt2.cpp stray '</code>' in program<br />
7 C:\Dev-Cpp\Unbenannt2.cpp stray '<code>' in program 7 C:\\Dev-Cpp\\Unbenannt2.cpp</code>j' undeclared (first use this function)<br />
C:\Dev-Cpp\Unbenannt2.cpp In function <code>bool accept2()': 12 C:\\Dev-Cpp\\Unbenannt2.cpp</code>cout' undeclared (first use this function)<br />
15 C:\Dev-Cpp\Unbenannt2.cpp <code>cin' undeclared (first use this function) 18 C:\\Dev-Cpp\\Unbenannt2.cpp stray '</code>' in program<br />
18 C:\Dev-Cpp\Unbenannt2.cpp stray '<code>' in program 18 C:\\Dev-Cpp\\Unbenannt2.cpp</code>j' undeclared (first use this function)<br />
20 C:\Dev-Cpp\Unbenannt2.cpp stray '<code>' in program 20 C:\\Dev-Cpp\\Unbenannt2.cpp stray '</code>' in program<br />
20 C:\Dev-Cpp\Unbenannt2.cpp <code>n' undeclared (first use this function) C:\\Dev-Cpp\\Unbenannt2.cpp In function</code>bool accept3()':<br />
31 C:\Dev-Cpp\Unbenannt2.cpp <code>cout' undeclared (first use this function) 33 C:\\Dev-Cpp\\Unbenannt2.cpp</code>cin' undeclared (first use this function)<br />
36 C:\Dev-Cpp\Unbenannt2.cpp stray '<code>' in program 36 C:\\Dev-Cpp\\Unbenannt2.cpp stray '</code>' in program<br />
36 C:\Dev-Cpp\Unbenannt2.cpp <code>j' undeclared (first use this function) 38 C:\\Dev-Cpp\\Unbenannt2.cpp expected</code>;' before &quot;case&quot;<br />
38 C:\Dev-Cpp\Unbenannt2.cpp stray '<code>' in program 38 C:\\Dev-Cpp\\Unbenannt2.cpp stray '</code>' in program<br />
38 C:\Dev-Cpp\Unbenannt2.cpp `n' undeclared (first use this function)</p>
<p>Woran kann das liegen??<br />
Benutze Dev-C++ von Bloodsheed</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/156853/3-c-dev-cpp-unbenannt2-cpp-cout-undeclared-first-use-this-function</link><generator>RSS for Node</generator><lastBuildDate>Tue, 08 Sep 2026 22:19:54 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/156853.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 20 Aug 2006 19:33:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 3 C:&#x5C;Dev-Cpp&#x5C;Unbenannt2.cpp &#96;cout&#x27; undeclared (first use this function) on Sun, 20 Aug 2006 19:33:54 GMT]]></title><description><![CDATA[<p>Hi</p>
<p>Habe mit C++ angefangen und bin dabei mit dem Bjarne Stroustroup-Buch zu lernen.<br />
Allerdings habe ich Probleme mit dem kompilieren einfachster Programme...</p>
<p>Habe folgenden Quellcode aus dem Buch einfach mal &quot;abgeschrieben&quot;:</p>
<pre><code>bool accept()
{
     cout &lt;&lt; &quot;Moechten Sie weitermachen (j oder n)?\n&quot;; // stelle Frage

     char antwort = 0;
     cin &gt;&gt; antwort;
     if (antwort == `j`) return true;
     return false;
}
bool accept2()
{
     cout &lt;&lt; &quot;Möchten Sie weitermachen (j oder n)?\n&quot;;

     char antwort = 0;
     cin &gt;&gt; antwort;

     switch (antwort) {
            case `j`:
                 return true;
            case `n`:
                 return false;
            default:
cout &lt;&lt; &quot;Ich halte das fuer ein Nein.\n&quot;;
return false;
}
}
bool accept3()
{
     int versuche = 1;
     while (versuche &lt; 4) {
           cout &lt;&lt; &quot;Moechten Sie weitermachen (j oder n)?\n&quot;;
           char antwort = 0;
           cin &gt;&gt; antwort;

           switch (antwort) {
                  case `j`:
                       return true
                  case `n`:
                       return false;
                  default:
                          cout &lt;&lt; &quot;Ich verstehe Sie leider nicht.\n&quot;;
                          versuche = versuche + 1;
                          }
                          }
                          cout &lt;&lt; &quot;Ich halte das für ein Nein.\n&quot;;
                          return false;
                          }
</code></pre>
<p>und bekomme beim kompilieren folgende Fehlermeldung:</p>
<p>C:\Dev-Cpp\Unbenannt2.cpp In function <code>bool accept()': 3 C:\\Dev-Cpp\\Unbenannt2.cpp</code>cout' undeclared (first use this function)<br />
(Each undeclared identifier is reported only once for each function it appears in.)<br />
6 C:\Dev-Cpp\Unbenannt2.cpp <code>cin' undeclared (first use this function) 7 C:\\Dev-Cpp\\Unbenannt2.cpp stray '</code>' in program<br />
7 C:\Dev-Cpp\Unbenannt2.cpp stray '<code>' in program 7 C:\\Dev-Cpp\\Unbenannt2.cpp</code>j' undeclared (first use this function)<br />
C:\Dev-Cpp\Unbenannt2.cpp In function <code>bool accept2()': 12 C:\\Dev-Cpp\\Unbenannt2.cpp</code>cout' undeclared (first use this function)<br />
15 C:\Dev-Cpp\Unbenannt2.cpp <code>cin' undeclared (first use this function) 18 C:\\Dev-Cpp\\Unbenannt2.cpp stray '</code>' in program<br />
18 C:\Dev-Cpp\Unbenannt2.cpp stray '<code>' in program 18 C:\\Dev-Cpp\\Unbenannt2.cpp</code>j' undeclared (first use this function)<br />
20 C:\Dev-Cpp\Unbenannt2.cpp stray '<code>' in program 20 C:\\Dev-Cpp\\Unbenannt2.cpp stray '</code>' in program<br />
20 C:\Dev-Cpp\Unbenannt2.cpp <code>n' undeclared (first use this function) C:\\Dev-Cpp\\Unbenannt2.cpp In function</code>bool accept3()':<br />
31 C:\Dev-Cpp\Unbenannt2.cpp <code>cout' undeclared (first use this function) 33 C:\\Dev-Cpp\\Unbenannt2.cpp</code>cin' undeclared (first use this function)<br />
36 C:\Dev-Cpp\Unbenannt2.cpp stray '<code>' in program 36 C:\\Dev-Cpp\\Unbenannt2.cpp stray '</code>' in program<br />
36 C:\Dev-Cpp\Unbenannt2.cpp <code>j' undeclared (first use this function) 38 C:\\Dev-Cpp\\Unbenannt2.cpp expected</code>;' before &quot;case&quot;<br />
38 C:\Dev-Cpp\Unbenannt2.cpp stray '<code>' in program 38 C:\\Dev-Cpp\\Unbenannt2.cpp stray '</code>' in program<br />
38 C:\Dev-Cpp\Unbenannt2.cpp `n' undeclared (first use this function)</p>
<p>Woran kann das liegen??<br />
Benutze Dev-C++ von Bloodsheed</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1121093</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1121093</guid><dc:creator><![CDATA[silentnoise]]></dc:creator><pubDate>Sun, 20 Aug 2006 19:33:54 GMT</pubDate></item><item><title><![CDATA[Reply to 3 C:&#x5C;Dev-Cpp&#x5C;Unbenannt2.cpp &#96;cout&#x27; undeclared (first use this function) on Sun, 20 Aug 2006 19:47:01 GMT]]></title><description><![CDATA[<p>Abtippen alleine reicht nicht. Man muss schon wissen, was man da so macht. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Schau mal hier:<br />
<a href="http://www.henkessoft.de/C++/C++/cpp_konsole.htm" rel="nofollow">http://www.henkessoft.de/C++/C++/cpp_konsole.htm</a><br />
<a href="http://www.henkessoft.de/C++/C++%20Fortgeschrittene/C++_Fortgeschrittene.htm#1.1._Tutorials_zum_Einstieg_in_C" rel="nofollow">http://www.henkessoft.de/C++/C++ Fortgeschrittene/C++_Fortgeschrittene.htm#1.1._Tutorials_zum_Einstieg_in_C</a></p>
<p>Versuche mal das hier:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

void wait() //ausführliche Version
{
    std::cin.clear();
    std::streambuf* pbuf = std::cin.rdbuf();
    std::streamsize size = pbuf-&gt;in_avail();
    std::cin.ignore(size);
    std::cin.get();
}

int main()
{
    std::cout &lt;&lt; &quot;C++ ist nix fuer Abtipper&quot; &lt;&lt; std::endl;    
    wait();   //verhindert &quot;Schließen der Konsole unter MS Windows&quot;
    return 0; //nicht unbedingt notwendig
}
</code></pre>
<p>Viel Spaß!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1121099</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1121099</guid><dc:creator><![CDATA[Erhard Henkes]]></dc:creator><pubDate>Sun, 20 Aug 2006 19:47:01 GMT</pubDate></item><item><title><![CDATA[Reply to 3 C:&#x5C;Dev-Cpp&#x5C;Unbenannt2.cpp &#96;cout&#x27; undeclared (first use this function) on Wed, 18 Mar 2009 18:08:23 GMT]]></title><description><![CDATA[<blockquote>
<p>C:\Dev-Cpp\Unbenannt2.cpp In function <code>bool accept()': 3 C:\\Dev-Cpp\\Unbenannt2.cpp</code>cout' undeclared (first use this function)</p>
</blockquote>
<p>Der Compiler meint (wie man hier ablesen kann), dass der Bezeichner (Identifier) <code>cout</code> nicht aufgelöst werden kann. Er weiss nicht, was er mit <code>cout</code> anfangen soll. Er vermutet zwar, dass es eine Variable oder ein Objekt sein könnte, aber er kann nirgends eine Deklaration finden. Damit hat er Recht, denn <code>cout</code> befindet sich in der iostream-Bibliothek, die du nicht eingebunden hast. Deshalb oben im Code</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
using namespace std;
</code></pre>
<p>einfügen oder noch besser, das <code>using namespace std;</code> weglassen und vor jedes <code>cin</code> / <code>cout</code> ein <code>std::</code> schreiben (also <code>std::cin</code> / <code>std::cout</code> ).</p>
<p>[edit]<br />
Erhard Henkes war schneller.<br />
[/edit]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1121104</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1121104</guid><dc:creator><![CDATA[skreutzer]]></dc:creator><pubDate>Wed, 18 Mar 2009 18:08:23 GMT</pubDate></item><item><title><![CDATA[Reply to 3 C:&#x5C;Dev-Cpp&#x5C;Unbenannt2.cpp &#96;cout&#x27; undeclared (first use this function) on Sun, 20 Aug 2006 20:17:13 GMT]]></title><description><![CDATA[<blockquote>
<p>Der Compiler meint ... weiss nicht, was er ... anfangen soll. Er vermutet zwar, ..., aber ... Damit hat er Recht, ...</p>
</blockquote>
<p>Einen Compiler sollte man nicht zu sehr &quot;vermenschlichen&quot;, auch wenn er von Menschen hergestellt wurde. <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="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1121114</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1121114</guid><dc:creator><![CDATA[Erhard Henkes]]></dc:creator><pubDate>Sun, 20 Aug 2006 20:17:13 GMT</pubDate></item><item><title><![CDATA[Reply to 3 C:&#x5C;Dev-Cpp&#x5C;Unbenannt2.cpp &#96;cout&#x27; undeclared (first use this function) on Wed, 18 Mar 2009 18:09:09 GMT]]></title><description><![CDATA[<p>Zu denken wie ein Compiler hilft bei der Fehlersuche ungemein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1121123</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1121123</guid><dc:creator><![CDATA[skreutzer]]></dc:creator><pubDate>Wed, 18 Mar 2009 18:09:09 GMT</pubDate></item></channel></rss>