<?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[Codebeispiel läßt sich nicht kompilieren]]></title><description><![CDATA[<p>Ich bin momentan dabei mich in C++ einzuarbeiten, dazu benutze ich das Onlinebuch OopDocbook. Unter dem ersten Kapitel &quot;C++ Standard Library strings&quot; findet sich folgendes Beispiel:</p>
<pre><code class="language-cpp">#include &lt;string&gt;
#include &lt;iostream&gt;

int main() {
    using namespace std;
    string s1(&quot;This &quot;), s2(&quot;is a &quot;), s3(&quot;string.&quot;);
    s1 += s2;  /* concatenation */
    string s4 = s1 + s3;
    cout &lt;&lt; s4 &lt;&lt; endl;

    string s5(&quot;The length of that string is: &quot;);
    cout &lt;&lt; s5 &lt;&lt; s4.length &lt;&lt; &quot; characters.&quot; &lt;&lt; endl;

    cout &lt;&lt; &quot;Enter a sentence: &quot; &lt;&lt; endl;
    getline(cin, s2);
    cout &lt;&lt; &quot;Here is your sentence: \n&quot; &lt;&lt; s2 &lt;&lt; endl;
    cout &lt;&lt; &quot;The length of it was: &quot; &lt;&lt; s2.length() &lt;&lt; endl;
    return 0;
}
</code></pre>
<p>Wenn ich dieses Beispiel unter Code:Blocks kompilieren möchte, kommt bei der Zeile &quot;cout &lt;&lt; s5 &lt;&lt; s4.length &lt;&lt; &quot; characters.&quot; &lt;&lt; endl;&quot; eine Fehlermeldung. &quot;Error: no match for 'operator&lt;&lt;' in 'std::operator&lt;&lt; ...&quot;.</p>
<p>Wenn ich jedoch s4.length samt dem einen &lt;&lt; rausnehme, geht es. Könnte mir vielleicht jemand bitte sagen was da falsch läuft? Ist das Beispiel nicht richtig oder liegt's an meinem Compiler und wenn ja, wie könnte ich das abändern?</p>
<p>Danke!<br />
Tsunami</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/153059/codebeispiel-läßt-sich-nicht-kompilieren</link><generator>RSS for Node</generator><lastBuildDate>Mon, 07 Sep 2026 04:31:47 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/153059.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 12 Jul 2006 12:37:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Codebeispiel läßt sich nicht kompilieren on Wed, 12 Jul 2006 12:37:15 GMT]]></title><description><![CDATA[<p>Ich bin momentan dabei mich in C++ einzuarbeiten, dazu benutze ich das Onlinebuch OopDocbook. Unter dem ersten Kapitel &quot;C++ Standard Library strings&quot; findet sich folgendes Beispiel:</p>
<pre><code class="language-cpp">#include &lt;string&gt;
#include &lt;iostream&gt;

int main() {
    using namespace std;
    string s1(&quot;This &quot;), s2(&quot;is a &quot;), s3(&quot;string.&quot;);
    s1 += s2;  /* concatenation */
    string s4 = s1 + s3;
    cout &lt;&lt; s4 &lt;&lt; endl;

    string s5(&quot;The length of that string is: &quot;);
    cout &lt;&lt; s5 &lt;&lt; s4.length &lt;&lt; &quot; characters.&quot; &lt;&lt; endl;

    cout &lt;&lt; &quot;Enter a sentence: &quot; &lt;&lt; endl;
    getline(cin, s2);
    cout &lt;&lt; &quot;Here is your sentence: \n&quot; &lt;&lt; s2 &lt;&lt; endl;
    cout &lt;&lt; &quot;The length of it was: &quot; &lt;&lt; s2.length() &lt;&lt; endl;
    return 0;
}
</code></pre>
<p>Wenn ich dieses Beispiel unter Code:Blocks kompilieren möchte, kommt bei der Zeile &quot;cout &lt;&lt; s5 &lt;&lt; s4.length &lt;&lt; &quot; characters.&quot; &lt;&lt; endl;&quot; eine Fehlermeldung. &quot;Error: no match for 'operator&lt;&lt;' in 'std::operator&lt;&lt; ...&quot;.</p>
<p>Wenn ich jedoch s4.length samt dem einen &lt;&lt; rausnehme, geht es. Könnte mir vielleicht jemand bitte sagen was da falsch läuft? Ist das Beispiel nicht richtig oder liegt's an meinem Compiler und wenn ja, wie könnte ich das abändern?</p>
<p>Danke!<br />
Tsunami</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1096403</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1096403</guid><dc:creator><![CDATA[Tsunami]]></dc:creator><pubDate>Wed, 12 Jul 2006 12:37:15 GMT</pubDate></item><item><title><![CDATA[Reply to Codebeispiel läßt sich nicht kompilieren on Wed, 12 Jul 2006 12:40:47 GMT]]></title><description><![CDATA[<p>Da muss</p>
<pre><code class="language-cpp">cout &lt;&lt; s5 &lt;&lt; s4.length() &lt;&lt; &quot; characters.&quot; &lt;&lt; endl;
</code></pre>
<p>hin. Beachte die Klamern hinter s4.length, also s4.length**()**, da es ein Funktionsaufruf ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1096408</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1096408</guid><dc:creator><![CDATA[Phoemuex]]></dc:creator><pubDate>Wed, 12 Jul 2006 12:40:47 GMT</pubDate></item><item><title><![CDATA[Reply to Codebeispiel läßt sich nicht kompilieren on Wed, 12 Jul 2006 12:47:11 GMT]]></title><description><![CDATA[<p>Jetzt wo du es sagst, sehe ich es auch.<br />
Ist natürlich ein Ding das solch ein Fehler in dem Tutorial drin ist.</p>
<p>Vielen Dank für die schnelle Hilfe!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1096416</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1096416</guid><dc:creator><![CDATA[Tsunami]]></dc:creator><pubDate>Wed, 12 Jul 2006 12:47:11 GMT</pubDate></item></channel></rss>