<?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[Linkerfehler: Verweis auf nicht aufgelöstes Symbol; Problem bei den includes?!]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>ich habe folgende 4 Klassen</p>
<p>class Ship, class Longboat -&gt; von Ship abgeleitet, class shippart und class cannon -&gt; von shippart abgeleitet.</p>
<p>es soll so ablaufen, dass ich im main ein neues &quot;Longboat&quot; erstelle -&gt; dann wird im Konstruktor von Longboat eine &quot;Cannon&quot; mit</p>
<pre><code>ship_parts_[0] = new CCannon(*(this), &quot;irgendwelche Koordinaten&quot;, 10)
</code></pre>
<p>erstellt. Es soll also die Referenz auf das Ship mitübergeben werden.</p>
<p>Die Konstruktoren von Shippart bzw. Cannon sehen so aus:</p>
<pre><code>CShipPart::CShipPart(CShip &amp;my_ship) : my_ship_(my_ship)
CCannon::CCannon(CShip&amp; my_ship, const CCoord&amp; pos, int fire_range) : CShipPart(my_ship)
</code></pre>
<p>Wenn ich die nun probier bekomm ich den oben erwähnten Linkerfehler.</p>
<p>Da ich vermute das ich bei den Includes ein Problem hab hab ich sie hier auch noch angeführt:<br />
Ship.h: class CShipPart;<br />
Ship.cpp: #include &quot;CShip.h&quot;<br />
Longboat.h: #include &quot;CShip.h&quot; , #include &quot;CCannon.h&quot;<br />
Longboat.cpp: #include &quot;CLongboat.h&quot;<br />
Shippart.h: class CShip;<br />
Shippart.cpp: #include &quot;CShipPart.h&quot;<br />
Cannon.h: #include &quot;CShipPart.h&quot;<br />
Cannon.cpp: #include &quot;CCannon.h&quot;<br />
//hier sollte meiner meinung nach ein #include&quot;Ship.h&quot; eingefügt werden, doch dann bekomm ich 'CShip': Mehrdeutiges Symbol</p>
<p>bitte um Hilfe,<br />
Lg Marco</p>
<p>Der Vollständigkeit halber hier die gesamte Fehlermeldung:<br />
&quot;Fehler 1 error LNK2019: Verweis auf nicht aufgelöstes externes Symbol &quot;&quot;public: __thiscall NavalWar::CCannon::CCannon(class NavalWar::CShip &amp;,struct NavalWar::CCoord const &amp;,int)&quot; (??0CCannon@NavalWar@@QAE@AAVCShip@1@ABUCCoord@1@H@Z)&quot; in Funktion &quot;&quot;public: __thiscall NavalWar::CLongboat::CLongboat(struct NavalWar::CCoord const &amp;,struct NavalWar::CCoord const &amp;,int)&quot; (??0CLongboat@NavalWar@@QAE@ABUCCoord@1@0H@Z)&quot;. CLongboat.obj SEP_EX2<br />
&quot;</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/238092/linkerfehler-verweis-auf-nicht-aufgelöstes-symbol-problem-bei-den-includes</link><generator>RSS for Node</generator><lastBuildDate>Wed, 23 Sep 2026 03:53:43 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/238092.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 06 Apr 2009 12:32:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Linkerfehler: Verweis auf nicht aufgelöstes Symbol; Problem bei den includes?! on Mon, 06 Apr 2009 12:32:41 GMT]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>ich habe folgende 4 Klassen</p>
<p>class Ship, class Longboat -&gt; von Ship abgeleitet, class shippart und class cannon -&gt; von shippart abgeleitet.</p>
<p>es soll so ablaufen, dass ich im main ein neues &quot;Longboat&quot; erstelle -&gt; dann wird im Konstruktor von Longboat eine &quot;Cannon&quot; mit</p>
<pre><code>ship_parts_[0] = new CCannon(*(this), &quot;irgendwelche Koordinaten&quot;, 10)
</code></pre>
<p>erstellt. Es soll also die Referenz auf das Ship mitübergeben werden.</p>
<p>Die Konstruktoren von Shippart bzw. Cannon sehen so aus:</p>
<pre><code>CShipPart::CShipPart(CShip &amp;my_ship) : my_ship_(my_ship)
CCannon::CCannon(CShip&amp; my_ship, const CCoord&amp; pos, int fire_range) : CShipPart(my_ship)
</code></pre>
<p>Wenn ich die nun probier bekomm ich den oben erwähnten Linkerfehler.</p>
<p>Da ich vermute das ich bei den Includes ein Problem hab hab ich sie hier auch noch angeführt:<br />
Ship.h: class CShipPart;<br />
Ship.cpp: #include &quot;CShip.h&quot;<br />
Longboat.h: #include &quot;CShip.h&quot; , #include &quot;CCannon.h&quot;<br />
Longboat.cpp: #include &quot;CLongboat.h&quot;<br />
Shippart.h: class CShip;<br />
Shippart.cpp: #include &quot;CShipPart.h&quot;<br />
Cannon.h: #include &quot;CShipPart.h&quot;<br />
Cannon.cpp: #include &quot;CCannon.h&quot;<br />
//hier sollte meiner meinung nach ein #include&quot;Ship.h&quot; eingefügt werden, doch dann bekomm ich 'CShip': Mehrdeutiges Symbol</p>
<p>bitte um Hilfe,<br />
Lg Marco</p>
<p>Der Vollständigkeit halber hier die gesamte Fehlermeldung:<br />
&quot;Fehler 1 error LNK2019: Verweis auf nicht aufgelöstes externes Symbol &quot;&quot;public: __thiscall NavalWar::CCannon::CCannon(class NavalWar::CShip &amp;,struct NavalWar::CCoord const &amp;,int)&quot; (??0CCannon@NavalWar@@QAE@AAVCShip@1@ABUCCoord@1@H@Z)&quot; in Funktion &quot;&quot;public: __thiscall NavalWar::CLongboat::CLongboat(struct NavalWar::CCoord const &amp;,struct NavalWar::CCoord const &amp;,int)&quot; (??0CLongboat@NavalWar@@QAE@ABUCCoord@1@0H@Z)&quot;. CLongboat.obj SEP_EX2<br />
&quot;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1691751</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1691751</guid><dc:creator><![CDATA[gadei]]></dc:creator><pubDate>Mon, 06 Apr 2009 12:32:41 GMT</pubDate></item><item><title><![CDATA[Reply to Linkerfehler: Verweis auf nicht aufgelöstes Symbol; Problem bei den includes?! on Mon, 06 Apr 2009 12:41:23 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Sieht aus als hättest du vergessen, eine Funktion zu definieren oder eine Blockklammer zu setzen.</p>
<p>Mfg.<br />
way</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1691757</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1691757</guid><dc:creator><![CDATA[Kóyaánasqatsi]]></dc:creator><pubDate>Mon, 06 Apr 2009 12:41:23 GMT</pubDate></item><item><title><![CDATA[Reply to Linkerfehler: Verweis auf nicht aufgelöstes Symbol; Problem bei den includes?! on Mon, 06 Apr 2009 12:42:32 GMT]]></title><description><![CDATA[<p>Der Linkerfehler besagt, dass der Linker keine Implementation, bzw. Definition, von den folgenden zwei Konstruktoren finden konnte:<br />
`NavalWar::CCannon::CCannon(class NavalWar::CShip &amp;,struct NavalWar::CCoord const &amp;,int);</p>
<p>NavalWar::CLongboat::CLongboat(struct NavalWar::CCoord const &amp;,struct NavalWar::CCoord const &amp;,int);`</p>
<p>Das hat also nichts mit Headern zu tun, sondern einfach damit, dass du vergessen hast, diese Konstruktoren zu definieren, ihnen also einen Rumpf zu geben.</p>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1691758</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1691758</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Mon, 06 Apr 2009 12:42:32 GMT</pubDate></item><item><title><![CDATA[Reply to Linkerfehler: Verweis auf nicht aufgelöstes Symbol; Problem bei den includes?! on Mon, 06 Apr 2009 14:10:30 GMT]]></title><description><![CDATA[<p>Danke erstmal für die schnellen Antworten!</p>
<p>Dravere schrieb:</p>
<blockquote>
<p>Das hat also nichts mit Headern zu tun, sondern einfach damit, dass du vergessen hast, diese Konstruktoren zu definieren, ihnen also einen Rumpf zu geben.</p>
</blockquote>
<p>...ich hoff ich habe dich nicht falsch verstanden ... auf jeden fall habe ich meine Konstruktoren so definiert:</p>
<p>Shippart.h:</p>
<pre><code>CShipPart(CShip &amp;my_ship);
</code></pre>
<p>Shippart.cpp:</p>
<pre><code>CShipPart::CShipPart(CShip &amp;my_ship) : my_ship_(my_ship){}
</code></pre>
<p>Cannon.h:</p>
<pre><code>CCannon(CShip &amp;my_ship_, const CCoord&amp; pos, int fire_range);
</code></pre>
<p>Cannon.cpp:</p>
<pre><code>CCannon::CCannon(CShip&amp; my_ship_, const CCoord&amp; pos, int fire_range) : CShipPart(my_ship_)
{
  pos_ = pos;
  fire_range_ = fire_range;
}
</code></pre>
<p>Longboat.h:</p>
<pre><code>CLongboat(const CCoord&amp; start, const CCoord&amp; end, int team);
</code></pre>
<p>Longboat.cpp:</p>
<pre><code>CLongboat::CLongboat(const CCoord&amp; start, const CCoord&amp; end, int team)
{
  ship_parts_[0] = new CCannon(*(this), start_, 12);
}
</code></pre>
<p>...oder was hast du mit &quot;Rumpf geben&quot; gemeint?</p>
<p>...Bitte nochmal kurz drüberschaun ... vielen Dank!</p>
<p>Lg Marco</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1691816</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1691816</guid><dc:creator><![CDATA[gadei]]></dc:creator><pubDate>Mon, 06 Apr 2009 14:10:30 GMT</pubDate></item><item><title><![CDATA[Reply to Linkerfehler: Verweis auf nicht aufgelöstes Symbol; Problem bei den includes?! on Mon, 06 Apr 2009 14:12:50 GMT]]></title><description><![CDATA[<p>Hast du die Definition der Konstruktoren auch in den Namensraum <code>NavalWar</code> gesteckt?</p>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1691818</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1691818</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Mon, 06 Apr 2009 14:12:50 GMT</pubDate></item><item><title><![CDATA[Reply to Linkerfehler: Verweis auf nicht aufgelöstes Symbol; Problem bei den includes?! on Mon, 06 Apr 2009 14:28:03 GMT]]></title><description><![CDATA[<p>Dravere schrieb:</p>
<blockquote>
<p>Hast du die Definition der Konstruktoren auch in den Namensraum <code>NavalWar</code> gesteckt?</p>
</blockquote>
<p>Ja, das hätt ich eigentlich gemacht.</p>
<p>Was auffält ist, dass ich mit der my_ship Instanze im CCannon auch nichts anstellen kann.<br />
(Habe versuch mir irgendein public int rauszuholen - Compilerfehler: Verwendung des undefinierten Typs &quot;CShip&quot; und Links von &quot;.my_number&quot; muss sich eine Klasse/Struktur/Union befinden.)</p>
<p>Ich weis nicht obs was damit zu tun haben kann...</p>
<p>LG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1691836</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1691836</guid><dc:creator><![CDATA[gadei]]></dc:creator><pubDate>Mon, 06 Apr 2009 14:28:03 GMT</pubDate></item><item><title><![CDATA[Reply to Linkerfehler: Verweis auf nicht aufgelöstes Symbol; Problem bei den includes?! on Mon, 06 Apr 2009 14:33:26 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Naja, sagt ja die Fehlermeldung bereits, worüber greifst du denn auf die public-variable zu? Mögliche Möglcihkeiten wären über nen Zeiger, Objekt...</p>
<p>Mfg.<br />
way</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1691841</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1691841</guid><dc:creator><![CDATA[Kóyaánasqatsi]]></dc:creator><pubDate>Mon, 06 Apr 2009 14:33:26 GMT</pubDate></item><item><title><![CDATA[Reply to Linkerfehler: Verweis auf nicht aufgelöstes Symbol; Problem bei den includes?! on Mon, 06 Apr 2009 14:39:55 GMT]]></title><description><![CDATA[<p>gadei schrieb:</p>
<blockquote>
<p>(Habe versuch mir irgendein public int rauszuholen - Compilerfehler: Verwendung des undefinierten Typs &quot;CShip&quot; und Links von &quot;.my_number&quot; muss sich eine Klasse/Struktur/Union befinden.)</p>
</blockquote>
<p>Der Typ <code>CShip</code> ist nicht bekannt, vielleicht hast du dessen Klassendefinition nicht eingebunden.</p>
<p>way schrieb:</p>
<blockquote>
<p>Naja, sagt ja die Fehlermeldung bereits, worüber greifst du denn auf die public-variable zu? Mögliche Möglcihkeiten wären über nen Zeiger, Objekt...</p>
</blockquote>
<p>Wie kommst du jetzt wieder auf sowas Abwegiges?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1691849</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1691849</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Mon, 06 Apr 2009 14:39:55 GMT</pubDate></item><item><title><![CDATA[Reply to Linkerfehler: Verweis auf nicht aufgelöstes Symbol; Problem bei den includes?! on Mon, 06 Apr 2009 14:51:40 GMT]]></title><description><![CDATA[<p>gadei schrieb:</p>
<blockquote>
<p>Ja, das hätt ich eigentlich gemacht.</p>
</blockquote>
<p>Sicher? Und wie? Wir hatten erst gerade letztens jemand, der das etwas anders gemacht hat, als es eigentlich üblich ist <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>Hast du auch nirgends vergessen die Klammern der Namensräume zu schliessen?</p>
<p>gadei schrieb:</p>
<blockquote>
<p>Was auffält ist, dass ich mit der my_ship Instanze im CCannon auch nichts anstellen kann.<br />
(Habe versuch mir irgendein public int rauszuholen - Compilerfehler: Verwendung des undefinierten Typs &quot;CShip&quot; und Links von &quot;.my_number&quot; muss sich eine Klasse/Struktur/Union befinden.)</p>
</blockquote>
<p>Dies hat wohl kaum was mit dem anderen Fehler zu tun. Das hat nun damit zu tun, dass du einen Header nicht eingebunden hast. Und zwar jener, in welchem CShip deklariert ist.</p>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1691859</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1691859</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Mon, 06 Apr 2009 14:51:40 GMT</pubDate></item></channel></rss>