<?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[[gelöst] Undefined reference bei Vererbung unerklärlich]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich habe ein Problem mit meinem Sourcecode. Und zwar habe ich eine Klasse die von der Klasse &quot;MapManupilation&quot; erbt. Wenn die Klasse &quot;MapManipulation&quot; wie folgt aussieht erscheint eine Fehlermeldung:</p>
<p>Header:</p>
<pre><code>#ifndef MAPCONTROLLING_H_
#define MAPCONTROLLING_H_

#include &quot;../Gui.hpp&quot;

namespace Ugv
{
	namespace Gui
	{
		namespace MapControlling
		{
            class MapControlling : public Ugv::Gui::Gui
			{
				public:
					MapControlling();
					~MapControlling();

			};
		};
	};
};

#endif
</code></pre>
<p>Source:</p>
<pre><code>#include &quot;MapControlling.hpp&quot;

Ugv::Gui::MapControlling::MapControlling::MapControlling() : Gui()
{
}

Ugv::Gui::MapControlling::MapControlling::~MapControlling()
{
}
</code></pre>
<p>Fehlermeldungen:<br />
/home/.../G12_mainwindow.cpp<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /> Fehler:undefined reference to <code>Ugv::Gui::MapControlling::MapControlling::MapControlling()' /home/.../G12_mainwindow.cpp:-1: Fehler:undefined reference to</code>Ugv::Gui::MapControlling::MapControlling::~MapControlling()'</p>
<p>Wenn ich allerdings die Funktionsdeklaration mit in den Header nehme tritt kein Fehler auf. Also wie folgt:</p>
<p>Header (beachte geschweifte Klammern hinter Funktion):</p>
<pre><code>#ifndef MAPCONTROLLING_H_
#define MAPCONTROLLING_H_

#include &quot;../Gui.hpp&quot;

namespace Ugv
{
	namespace Gui
	{
		namespace MapControlling
		{
            class MapControlling : public Ugv::Gui::Gui
			{
				public:
					MapControlling(){};
					~MapControlling(){};

			};
		};
	};
};

#endif
</code></pre>
<p>Kann mir jemand erklären was da falsch läuft ??</p>
<p>Vielen Dank schonmal.<br />
tuxing</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/303916/gelöst-undefined-reference-bei-vererbung-unerklärlich</link><generator>RSS for Node</generator><lastBuildDate>Mon, 10 Aug 2026 00:49:46 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/303916.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 25 May 2012 07:22:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [gelöst] Undefined reference bei Vererbung unerklärlich on Wed, 30 May 2012 06:16:52 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich habe ein Problem mit meinem Sourcecode. Und zwar habe ich eine Klasse die von der Klasse &quot;MapManupilation&quot; erbt. Wenn die Klasse &quot;MapManipulation&quot; wie folgt aussieht erscheint eine Fehlermeldung:</p>
<p>Header:</p>
<pre><code>#ifndef MAPCONTROLLING_H_
#define MAPCONTROLLING_H_

#include &quot;../Gui.hpp&quot;

namespace Ugv
{
	namespace Gui
	{
		namespace MapControlling
		{
            class MapControlling : public Ugv::Gui::Gui
			{
				public:
					MapControlling();
					~MapControlling();

			};
		};
	};
};

#endif
</code></pre>
<p>Source:</p>
<pre><code>#include &quot;MapControlling.hpp&quot;

Ugv::Gui::MapControlling::MapControlling::MapControlling() : Gui()
{
}

Ugv::Gui::MapControlling::MapControlling::~MapControlling()
{
}
</code></pre>
<p>Fehlermeldungen:<br />
/home/.../G12_mainwindow.cpp<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /> Fehler:undefined reference to <code>Ugv::Gui::MapControlling::MapControlling::MapControlling()' /home/.../G12_mainwindow.cpp:-1: Fehler:undefined reference to</code>Ugv::Gui::MapControlling::MapControlling::~MapControlling()'</p>
<p>Wenn ich allerdings die Funktionsdeklaration mit in den Header nehme tritt kein Fehler auf. Also wie folgt:</p>
<p>Header (beachte geschweifte Klammern hinter Funktion):</p>
<pre><code>#ifndef MAPCONTROLLING_H_
#define MAPCONTROLLING_H_

#include &quot;../Gui.hpp&quot;

namespace Ugv
{
	namespace Gui
	{
		namespace MapControlling
		{
            class MapControlling : public Ugv::Gui::Gui
			{
				public:
					MapControlling(){};
					~MapControlling(){};

			};
		};
	};
};

#endif
</code></pre>
<p>Kann mir jemand erklären was da falsch läuft ??</p>
<p>Vielen Dank schonmal.<br />
tuxing</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2215225</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2215225</guid><dc:creator><![CDATA[tuxing]]></dc:creator><pubDate>Wed, 30 May 2012 06:16:52 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst] Undefined reference bei Vererbung unerklärlich on Fri, 25 May 2012 07:49:25 GMT]]></title><description><![CDATA[<p>Du bindest die Objektdatei mit den Funktionen dazu?</p>
<p>Hinter die } des namespace muss/soll man keine ; schreiben</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2215238</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2215238</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Fri, 25 May 2012 07:49:25 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst] Undefined reference bei Vererbung unerklärlich on Fri, 25 May 2012 08:39:00 GMT]]></title><description><![CDATA[<p>Dir ist klar, dass du dir einen leeren, <em>public</em> Destruktor und Konstruktor auch gänzlich sparen kannst?</p>
<p>edit: Korrektur für Klugscheißer :p</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2215244</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2215244</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Fri, 25 May 2012 08:39:00 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst] Undefined reference bei Vererbung unerklärlich on Fri, 25 May 2012 08:29:11 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<p>Dir ist klar, dass du dir einen leeren Destruktor und Konstruktor auch gänzlich sparen kannst?</p>
</blockquote>
<p>Wenn sie public sind...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2215249</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2215249</guid><dc:creator><![CDATA[theta]]></dc:creator><pubDate>Fri, 25 May 2012 08:29:11 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst] Undefined reference bei Vererbung unerklärlich on Fri, 25 May 2012 08:38:03 GMT]]></title><description><![CDATA[<p>theta schrieb:</p>
<blockquote>
<p>SeppJ schrieb:</p>
<blockquote>
<p>Dir ist klar, dass du dir einen leeren Destruktor und Konstruktor auch gänzlich sparen kannst?</p>
</blockquote>
<p>Wenn sie public sind...</p>
</blockquote>
<p>Korrigiert.</p>
<p>In C++11 kann man sie übrigens auch private und protected auf default setzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2215252</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2215252</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Fri, 25 May 2012 08:38:03 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst] Undefined reference bei Vererbung unerklärlich on Wed, 30 May 2012 06:15:42 GMT]]></title><description><![CDATA[<p>Hallo,<br />
also die Konstruktoren sind leer, weil das ein Minimalbeispiel sein sollte. Wollte euch da nicht unnötiges Zeug reinschreiben.</p>
<p>manni66 hatte das Problem erkannt. Hab ich glatt übersehen <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="😉"
    /> Ich arbeite mit CMakeLists (cmake) und lasse die Header- und Sourcedateien automatisch suchen. Allerdings liegt die Klasse von der ich erbe in der Ordnerstruktur eine Ebene höher, weshalb der Compiler die nicht gefunden hat. Ich hab das ganze in die CMakeLists eingetragen und es funktioniert.</p>
<p>Danke für die Hilfe <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2217106</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2217106</guid><dc:creator><![CDATA[tuxing]]></dc:creator><pubDate>Wed, 30 May 2012 06:15:42 GMT</pubDate></item></channel></rss>