<?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[Dreiecksinclude]]></title><description><![CDATA[<p>Hallo,<br />
ich bräuchte folgendes:</p>
<pre><code class="language-cpp">// A.h
#include &quot;Bin.h&quot;
#include &quot;Bout.h&quot;
class A
{
public:
  BinListe ListeBInput;
  BoutListe ListeBOutput;
};

// B.h
#include &quot;A.h&quot;
class B
{
public:
  A* MyMother;
};

// Bin.h
#include &quot;B.h&quot;
class Bin : public B {};
#include &lt;map&gt;
typedef std::map&lt;unsigned short, Bin*&gt; BinListe;

// Bout.h
#include &quot;B.h&quot;
class Bout : public B {};
#include &lt;map&gt;
typedef std::map&lt;unsigned short, Bout*&gt; BoutListe;
</code></pre>
<p>Nunja, mein Problem ist jetzt, dass ich bei den Input und Output-Klassen immer ein &quot;Basisklasse undefiniert&quot; für das &quot;: public B&quot; bekomme.</p>
<p>Ich weiß schon gar nicht mehr wie ich das vorrausdeklarieren soll, damit das funktioniert.</p>
<p>Hilfe,<br />
Stefan</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/276241/dreiecksinclude</link><generator>RSS for Node</generator><lastBuildDate>Wed, 26 Aug 2026 11:47:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/276241.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 29 Oct 2010 14:18:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Dreiecksinclude on Fri, 29 Oct 2010 14:18:06 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich bräuchte folgendes:</p>
<pre><code class="language-cpp">// A.h
#include &quot;Bin.h&quot;
#include &quot;Bout.h&quot;
class A
{
public:
  BinListe ListeBInput;
  BoutListe ListeBOutput;
};

// B.h
#include &quot;A.h&quot;
class B
{
public:
  A* MyMother;
};

// Bin.h
#include &quot;B.h&quot;
class Bin : public B {};
#include &lt;map&gt;
typedef std::map&lt;unsigned short, Bin*&gt; BinListe;

// Bout.h
#include &quot;B.h&quot;
class Bout : public B {};
#include &lt;map&gt;
typedef std::map&lt;unsigned short, Bout*&gt; BoutListe;
</code></pre>
<p>Nunja, mein Problem ist jetzt, dass ich bei den Input und Output-Klassen immer ein &quot;Basisklasse undefiniert&quot; für das &quot;: public B&quot; bekomme.</p>
<p>Ich weiß schon gar nicht mehr wie ich das vorrausdeklarieren soll, damit das funktioniert.</p>
<p>Hilfe,<br />
Stefan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1972357</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1972357</guid><dc:creator><![CDATA[stefanjann]]></dc:creator><pubDate>Fri, 29 Oct 2010 14:18:06 GMT</pubDate></item><item><title><![CDATA[Reply to Dreiecksinclude on Fri, 29 Oct 2010 14:41:37 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">// A.h
#include &quot;Bin.h&quot;
#include &quot;Bout.h&quot;
class A
{
public:
  BinListe ListeBInput;
  BoutListe ListeBOutput;
};

// B.h
class A;    // Du brauchst nur einen Zeiger auf A -&gt; Deklaration

class B
{
public:
  A* MyMother;
};

// Bin.h
#include &lt;map&gt;    // Includes am besten immer oben in Dateien
#include &quot;B.h&quot;
class Bin : public B {};

typedef std::map&lt;unsigned short, Bin*&gt; BinListe;

// Bout.h
#include &lt;map&gt;
#include &quot;B.h&quot;
class Bout : public B {};
typedef std::map&lt;unsigned short, Bout*&gt; BoutListe;
</code></pre>
<p>Wenns nötig ist, kannst du auch noch:</p>
<pre><code class="language-cpp">// A.h
#include &lt;map&gt;

class Bin;
class Bout;

class A
{
public:
  std::map&lt;unsigned short, Bin*&gt; ListeBInput;
  std::map&lt;unsigned short, Bout*&gt; ListeBOutput;
};

// B.h
class A;    // Du brauchst nur einen Zeiger auf A -&gt; Deklaration

class B
{
public:
  A* MyMother;
};

// Bin.h
#include &lt;map&gt;    // Includes am besten immer oben in Dateien
#include &quot;B.h&quot;
class Bin : public B {};

typedef std::map&lt;unsigned short, Bin*&gt; BinListe;

// Bout.h
#include &lt;map&gt;
#include &quot;B.h&quot;
class Bout : public B {};
typedef std::map&lt;unsigned short, Bout*&gt; BoutListe;
</code></pre>
<p>oder wenn du BinListe und BoutListe in mehreren Dateien brauchst:</p>
<pre><code class="language-cpp">// b_forward_declarations.h
#include &lt;map&gt;
class Bin;
class Bout;

typedef std::map&lt;unsigned short, Bin*&gt; BinListe;
typedef std::map&lt;unsigned short, Bout*&gt; BoutListe;

// A.h
#include &lt;map&gt;
#include &quot;b_forward_declarations.h&quot;

class A
{
public:
  BinListe ListeBInput;
  BoutListe ListeBOutput;
};

// B.h
class A;    // Du brauchst nur einen Zeiger auf A -&gt; Deklaration

class B
{
public:
  A* MyMother;
};

// Bin.h
#include &lt;map&gt;    // Includes am besten immer oben in Dateien
#include &quot;B.h&quot;
#include &quot;b_forward_declarations.h&quot;
class Bin : public B {};

// Bout.h
#include &lt;map&gt;
#include &quot;B.h&quot;
#include &quot;b_forward_declarations.h&quot;
class Bout : public B {};
</code></pre>
<p>Aber Bin.h und Bout.h müssen B zwingend inkludieren, solange B Basisklasse ist, da dafür die Definition gebraucht wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1972362</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1972362</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Fri, 29 Oct 2010 14:41:37 GMT</pubDate></item><item><title><![CDATA[Reply to Dreiecksinclude on Fri, 29 Oct 2010 14:34:31 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">// A.h
#include &quot;Bin.h&quot;
#include &quot;Bout.h&quot;
class A
{
public:
  BinListe ListeBInput;
  BoutListe ListeBOutput;
};

// B.h
class A;
class B
{
public:
  A* MyMother;
};
#include &quot;A.h&quot; // Ohne den macht er es nicht. Muss unten stehen.

// Bin.h
#include &lt;map&gt;
#include &quot;B.h&quot;
class Bin : public B {};
typedef std::map&lt;unsigned short, Bin*&gt; BinListe;

// Bout.h
#include &lt;map&gt;
#include &quot;B.h&quot;
class Bout : public B {};
typedef std::map&lt;unsigned short, Bout*&gt; BoutListe;
</code></pre>
<p>Danke schön. Eins hatte er noch (siehe Kommentar), sonst sagt er in der DLL-Verision, dass die Klasse zwar deklariert wurde, aber keine Daten da sind. Und der #include &lt;map&gt; stand nur unten, damit man gleich sieht, dass die Liste eine Standard-Map ist. Steht natürlich immer oben bei mir.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1972365</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1972365</guid><dc:creator><![CDATA[stefanjann]]></dc:creator><pubDate>Fri, 29 Oct 2010 14:34:31 GMT</pubDate></item><item><title><![CDATA[Reply to Dreiecksinclude on Fri, 29 Oct 2010 14:40:27 GMT]]></title><description><![CDATA[<p>stefanjann schrieb:</p>
<blockquote>
<p>Eins hatte er noch (siehe Kommentar), sonst sagt er in der DLL-Verision, dass die Klasse zwar deklariert wurde, aber keine Daten da sind.</p>
</blockquote>
<p>Das sollte er eigentlich nicht tun. Gibt es keine A.cpp, die zum Projekt gehört?</p>
<p>Ich geh mal davon aus, dass du Include Guards hast.</p>
<p>BTW: Hab mein obiges Posting noch erweitert, nachdem du bereits geantwortet hast.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1972368</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1972368</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Fri, 29 Oct 2010 14:40:27 GMT</pubDate></item><item><title><![CDATA[Reply to Dreiecksinclude on Fri, 29 Oct 2010 14:43:26 GMT]]></title><description><![CDATA[<p>Michael E. schrieb:</p>
<blockquote>
<p>stefanjann schrieb:</p>
<blockquote>
<p>Eins hatte er noch (siehe Kommentar), sonst sagt er in der DLL-Verision, dass die Klasse zwar deklariert wurde, aber keine Daten da sind.</p>
</blockquote>
<p>Das sollte er eigentlich nicht tun. Gibt es keine A.cpp, die zum Projekt gehört?</p>
</blockquote>
<p>Nein, zum Testen gab es keine .cpp-Datei. Aber wenn es cpp-Dateien gibt, dann braucht man keinen #include, da hast du recht.</p>
<p>Zum erweiteren Listening: Ich hab eh eine &quot;Declare.h&quot; wo ich meine ganzen Typen definiere (viel typedef wegen Win und Mac kompatibel), da füg ich das noch mit ein. Das ist ne gut Idee.</p>
<p>Danke vielmals.</p>
<p>Stefan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1972372</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1972372</guid><dc:creator><![CDATA[stefanjann]]></dc:creator><pubDate>Fri, 29 Oct 2010 14:43:26 GMT</pubDate></item><item><title><![CDATA[Reply to Dreiecksinclude on Fri, 29 Oct 2010 14:45:59 GMT]]></title><description><![CDATA[<p>stefanjann schrieb:</p>
<blockquote>
<p>Michael E. schrieb:</p>
<blockquote>
<p>Das sollte er eigentlich nicht tun. Gibt es keine A.cpp, die zum Projekt gehört?</p>
</blockquote>
<p>Nein, zum Testen gab es keine .cpp-Datei.</p>
</blockquote>
<p>Dann lag da der Fehler. Wenn die A.h nie inkludiert wurde, ist natürlich auch keine Definition von A vorhanden <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="😉"
    /> Aber sobald es eine A.cpp gibt, die A.h natürlich einbindet, löst sich das Problem von alleine.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1972375</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1972375</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Fri, 29 Oct 2010 14:45:59 GMT</pubDate></item></channel></rss>