<?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[new funktioniert nicht]]></title><description><![CDATA[<p>Folgendes Beispiel macht keinen Sinn und ist völlig hirnlos, sollte aber zu kompillieren sein. Ich möchte wissen, warum minGW diesen Code nicht kompillieren will.</p>
<pre><code>std::string *test;
test = new std::string(&quot;Hallo Welt!&quot;);
//error: cannot convert 'std::string' to 'std::string*' in assignment
</code></pre>
<p>Visual Studio macht das ohne Probleme. Ich habe Code::Blocks sogar schon neu installiert, aber er will trotzdem nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/310778/new-funktioniert-nicht</link><generator>RSS for Node</generator><lastBuildDate>Tue, 04 Aug 2026 05:35:09 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/310778.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 19 Nov 2012 18:47:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to new funktioniert nicht on Mon, 19 Nov 2012 18:47:20 GMT]]></title><description><![CDATA[<p>Folgendes Beispiel macht keinen Sinn und ist völlig hirnlos, sollte aber zu kompillieren sein. Ich möchte wissen, warum minGW diesen Code nicht kompillieren will.</p>
<pre><code>std::string *test;
test = new std::string(&quot;Hallo Welt!&quot;);
//error: cannot convert 'std::string' to 'std::string*' in assignment
</code></pre>
<p>Visual Studio macht das ohne Probleme. Ich habe Code::Blocks sogar schon neu installiert, aber er will trotzdem nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2272467</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2272467</guid><dc:creator><![CDATA[Qute]]></dc:creator><pubDate>Mon, 19 Nov 2012 18:47:20 GMT</pubDate></item><item><title><![CDATA[Reply to new funktioniert nicht on Mon, 19 Nov 2012 18:54:59 GMT]]></title><description><![CDATA[<p>Die zwei Zeilen werden definitiv von keinem C++-Compiler ohne Fehlermeldung übersetzt. Wie sieht also das echte Programm aus?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2272471</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2272471</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Mon, 19 Nov 2012 18:54:59 GMT</pubDate></item><item><title><![CDATA[Reply to new funktioniert nicht on Mon, 19 Nov 2012 19:31:13 GMT]]></title><description><![CDATA[<pre><code>#include &lt;string&gt;

int main()
{
	std::string *test;
	test = new std::string(&quot;hallo&quot;);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2272482</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2272482</guid><dc:creator><![CDATA[Belli]]></dc:creator><pubDate>Mon, 19 Nov 2012 19:31:13 GMT</pubDate></item><item><title><![CDATA[Reply to new funktioniert nicht on Tue, 20 Nov 2012 07:40:06 GMT]]></title><description><![CDATA[<p>manni66 schrieb:</p>
<blockquote>
<p>Die zwei Zeilen werden definitiv von keinem C++-Compiler ohne Fehlermeldung übersetzt. Wie sieht also das echte Programm aus?</p>
</blockquote>
<p>Warum? Ich erkenne daran nichts fehlerhaftes.<br />
Erkläre mir das bitte.</p>
<pre><code>#include &lt;string&gt;

int main()
{
    std::string *test;
    test = new std::string(&quot;hallo&quot;);
}
</code></pre>
<p>Der Code kompiliert bei mir auch wunderbar mit GCC (halt unter Linux, ist aber prinzipiell der gleiche Compiler...).<br />
Man kann halt bemängeln, dass das delete fehlt oder, dass generell kein Smart Pointer verwendet wurde, aber syntaktisch ist der Code voll in Ordnung.</p>
<p>Qute schrieb:</p>
<blockquote>
<p>Ich möchte wissen, warum minGW diesen Code nicht kompillieren will.</p>
<p>...</p>
<p>Visual Studio macht das ohne Probleme. Ich habe Code::Blocks sogar schon neu installiert, aber er will trotzdem nicht.</p>
</blockquote>
<p>Ganz ehrlich, wenn du mal eine konkrete Fehlermeldung vom MinGW gepostet hättest,<br />
könnte man dir unter Umständen sogar weiterhelfen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2272591</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2272591</guid><dc:creator><![CDATA[DrakoXP]]></dc:creator><pubDate>Tue, 20 Nov 2012 07:40:06 GMT</pubDate></item><item><title><![CDATA[Reply to new funktioniert nicht on Tue, 20 Nov 2012 07:48:49 GMT]]></title><description><![CDATA[<p>DrakoXP schrieb:</p>
<blockquote>
<p>manni66 schrieb:</p>
<blockquote>
<p>Die zwei Zeilen werden definitiv von keinem C++-Compiler ohne Fehlermeldung übersetzt. Wie sieht also das echte Programm aus?</p>
</blockquote>
<p>Warum? Ich erkenne daran nichts fehlerhaftes.<br />
Erkläre mir das bitte.</p>
</blockquote>
<p>Genau, der Fehler liegt im Rest des Programms, ohne den diese Zeilen nicht übersetzt werden. Oder es ist eben (wie so oft) nicht der wirkliche Code.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2272593</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2272593</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Tue, 20 Nov 2012 07:48:49 GMT</pubDate></item><item><title><![CDATA[Reply to new funktioniert nicht on Tue, 20 Nov 2012 08:15:06 GMT]]></title><description><![CDATA[<p>manni66 schrieb:</p>
<blockquote>
<p>Die zwei Zeilen werden definitiv von keinem C++-Compiler ohne Fehlermeldung übersetzt.</p>
</blockquote>
<p>manni66 schrieb:</p>
<blockquote>
<p>Genau, der Fehler liegt im Rest des Programms, ohne den diese Zeilen nicht übersetzt werden.</p>
</blockquote>
<p>Beides völlig falsche Aussagen. Vielleicht meinst du ja sogar das Richtige, sagst aber definitiv das Falsche. Du solltest mal an deinen Formulierungen arbeiten. <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/2272598</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2272598</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Tue, 20 Nov 2012 08:15:06 GMT</pubDate></item><item><title><![CDATA[Reply to new funktioniert nicht on Tue, 20 Nov 2012 08:52:14 GMT]]></title><description><![CDATA[<p>Ich glaube er meinte, dass die 2 Zeilen alleine nich kompilierbar sind (ohne main).<br />
Darum soll er das vollständige Programm posten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2272605</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2272605</guid><dc:creator><![CDATA[out]]></dc:creator><pubDate>Tue, 20 Nov 2012 08:52:14 GMT</pubDate></item><item><title><![CDATA[Reply to new funktioniert nicht on Tue, 20 Nov 2012 12:08:36 GMT]]></title><description><![CDATA[<p>DrakoXP schrieb:</p>
<blockquote>
<p>Ganz ehrlich, wenn du mal eine konkrete Fehlermeldung vom MinGW gepostet hättest,<br />
könnte man dir unter Umständen sogar weiterhelfen.</p>
</blockquote>
<p>Genau.</p>
<p>@Qute<br />
Ohne eine Fehlermeldung kann man nur rumraten, und das interessiert wohl keinen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2272694</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2272694</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Tue, 20 Nov 2012 12:08:36 GMT</pubDate></item><item><title><![CDATA[Reply to new funktioniert nicht on Tue, 20 Nov 2012 13:38:00 GMT]]></title><description><![CDATA[<p>Qute schrieb:</p>
<blockquote>
<pre><code>std::string *test;
test = new std::string(&quot;Hallo Welt!&quot;);
//error: cannot convert 'std::string' to 'std::string*' in assignment
</code></pre>
<p>Visual Studio macht das ohne Probleme. Ich habe Code::Blocks sogar schon neu installiert, aber er will trotzdem nicht.</p>
</blockquote>
<p>error_ cannot convert 'std::string to 'std::string*' in assignment</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2272756</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2272756</guid><dc:creator><![CDATA[out]]></dc:creator><pubDate>Tue, 20 Nov 2012 13:38:00 GMT</pubDate></item><item><title><![CDATA[Reply to new funktioniert nicht on Tue, 20 Nov 2012 20:25:27 GMT]]></title><description><![CDATA[<p>DrakoXP schrieb:</p>
<blockquote>
<p>Man kann halt bemängeln, dass das delete fehlt oder, dass generell kein Smart Pointer verwendet wurde, aber syntaktisch ist der Code voll in Ordnung.</p>
</blockquote>
<p>Das Beispiel ist korrektes C++ und lässt sich übersetzen. Man könnte eher bemängeln, überhaupt einen std::string mit new anzulegen. Das ist schon sehr obskur. Eher würde man so was erwarten:</p>
<pre><code>std::string test;
test = &quot;hallo&quot;;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2272916</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2272916</guid><dc:creator><![CDATA[tntnet]]></dc:creator><pubDate>Tue, 20 Nov 2012 20:25:27 GMT</pubDate></item><item><title><![CDATA[Reply to new funktioniert nicht on Wed, 21 Nov 2012 00:28:58 GMT]]></title><description><![CDATA[<p>out schrieb:</p>
<blockquote>
<p>Qute schrieb:</p>
<blockquote>
<pre><code>std::string *test;
test = new std::string(&quot;Hallo Welt!&quot;);
//error: cannot convert 'std::string' to 'std::string*' in assignment
</code></pre>
<p>Visual Studio macht das ohne Probleme. Ich habe Code::Blocks sogar schon neu installiert, aber er will trotzdem nicht.</p>
</blockquote>
<p>error_ cannot convert 'std::string to 'std::string*' in assignment</p>
</blockquote>
<p>Diese Fehlermeldung kann bei dem Code-Stück aber nicht kommen.<br />
Die könnte nur kommen wenn das &quot;new&quot; nicht da stehen würde.<br />
Hast du vielleicht irgendwo ein</p>
<pre><code class="language-cpp">#define new
</code></pre>
<p>stehen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2272979</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2272979</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Wed, 21 Nov 2012 00:28:58 GMT</pubDate></item></channel></rss>