<?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[verzwickte Situation]]></title><description><![CDATA[<p>Hallo ich habe vollgendes Problem:</p>
<p>Ich habe zwei Klassen, nennen wir sie mal hier X und Y, die jeweils in eine datei x.h und y.h geschrieben sind. Jede dieser Klassen hat einen Zeiger auf die andere Klasse. Leider kann der Linker dies nicht ohne weiteres auflösen :(. Aber seht selbst:</p>
<p>x.h</p>
<pre><code>#ifndef X_H
#define X_H

#include &quot;y.h&quot;

class X {
 Y* y;
}

#endif
</code></pre>
<p>y.h</p>
<pre><code>#ifndef Y_H
#define Y_H

#include &quot;x.h&quot;

class Y {
  X* x;
}

#endif
</code></pre>
<p>Weiß jemand von euch da eine Lösung <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/140687/verzwickte-situation</link><generator>RSS for Node</generator><lastBuildDate>Mon, 31 Aug 2026 08:55:53 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/140687.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 16 Mar 2006 15:42:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to verzwickte Situation on Thu, 16 Mar 2006 15:42:40 GMT]]></title><description><![CDATA[<p>Hallo ich habe vollgendes Problem:</p>
<p>Ich habe zwei Klassen, nennen wir sie mal hier X und Y, die jeweils in eine datei x.h und y.h geschrieben sind. Jede dieser Klassen hat einen Zeiger auf die andere Klasse. Leider kann der Linker dies nicht ohne weiteres auflösen :(. Aber seht selbst:</p>
<p>x.h</p>
<pre><code>#ifndef X_H
#define X_H

#include &quot;y.h&quot;

class X {
 Y* y;
}

#endif
</code></pre>
<p>y.h</p>
<pre><code>#ifndef Y_H
#define Y_H

#include &quot;x.h&quot;

class Y {
  X* x;
}

#endif
</code></pre>
<p>Weiß jemand von euch da eine Lösung <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1017647</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1017647</guid><dc:creator><![CDATA[Klausi]]></dc:creator><pubDate>Thu, 16 Mar 2006 15:42:40 GMT</pubDate></item><item><title><![CDATA[Reply to verzwickte Situation on Thu, 16 Mar 2006 15:46:31 GMT]]></title><description><![CDATA[<p>Du kannst Klassen eben zu diesem Zweck 'vorankündigen'.</p>
<pre><code class="language-cpp">class Y;

class X {
 Y* y;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1017652</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1017652</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Thu, 16 Mar 2006 15:46:31 GMT</pubDate></item><item><title><![CDATA[Reply to verzwickte Situation on Thu, 16 Mar 2006 15:46:53 GMT]]></title><description><![CDATA[<p>Hi!</p>
<p>Vordeklarieren?</p>
<pre><code class="language-cpp">X.H

class Y;

class X
{
  Y *y;
};

X.CPP

#include &quot;y.h&quot;
</code></pre>
<p>Und bei y.h / y.cpp genauso.</p>
<p>grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1017653</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1017653</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Thu, 16 Mar 2006 15:46:53 GMT</pubDate></item><item><title><![CDATA[Reply to verzwickte Situation on Thu, 16 Mar 2006 15:48:01 GMT]]></title><description><![CDATA[<p>beim includen von y.h im ersten code-frag braucht er ja den Quelltext von y , die aber wiederum den Quelltext von x included , der aber ohne y noch nicht praesent ist .... und umgekehrt ....</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1017655</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1017655</guid><dc:creator><![CDATA[bumbytie]]></dc:creator><pubDate>Thu, 16 Mar 2006 15:48:01 GMT</pubDate></item><item><title><![CDATA[Reply to verzwickte Situation on Thu, 16 Mar 2006 15:52:04 GMT]]></title><description><![CDATA[<p>Vielen Dank für die schnelle Antwort, es funktioniert :). Juhuuu</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1017659</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1017659</guid><dc:creator><![CDATA[Klausi]]></dc:creator><pubDate>Thu, 16 Mar 2006 15:52:04 GMT</pubDate></item></channel></rss>