<?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[Was bedeutet: Fehler: ISO-C++ verbietet Deklaration von ..]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich habe zwei Klasse A und B. In der Datei B.h definiere ich folgendes:</p>
<pre><code class="language-cpp">...
private:
	int x1,x2,y1,y2; 	//outlines the part of the board which should be calculated by the client
	IPAddress server;
	IPNetwork* net;
      A* client;

	int startUp();

...
</code></pre>
<p>Beim compilieren erhalte ich folgendes:</p>
<pre><code>include/game/client/B.h:44: Fehler: ISO-C++ verbietet Deklaration von »A« ohne Typ
include/game/client/B.h:44: Fehler: expected »;« before »*« token
</code></pre>
<p>A ist auch eine Cpp Datei mit Header und CC File und definiert einen Konstruktor<br />
in Form von</p>
<pre><code class="language-cpp">A(B* b, int x1, int x2, ... );
</code></pre>
<p>Was ist da falsch? Da ich ein Anfänger bin, bin ich über jede Hilfe hoch erfreut.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/165174/was-bedeutet-fehler-iso-c-verbietet-deklaration-von</link><generator>RSS for Node</generator><lastBuildDate>Mon, 14 Sep 2026 05:43:48 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/165174.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 16 Nov 2006 10:07:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Was bedeutet: Fehler: ISO-C++ verbietet Deklaration von .. on Thu, 16 Nov 2006 10:07:18 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich habe zwei Klasse A und B. In der Datei B.h definiere ich folgendes:</p>
<pre><code class="language-cpp">...
private:
	int x1,x2,y1,y2; 	//outlines the part of the board which should be calculated by the client
	IPAddress server;
	IPNetwork* net;
      A* client;

	int startUp();

...
</code></pre>
<p>Beim compilieren erhalte ich folgendes:</p>
<pre><code>include/game/client/B.h:44: Fehler: ISO-C++ verbietet Deklaration von »A« ohne Typ
include/game/client/B.h:44: Fehler: expected »;« before »*« token
</code></pre>
<p>A ist auch eine Cpp Datei mit Header und CC File und definiert einen Konstruktor<br />
in Form von</p>
<pre><code class="language-cpp">A(B* b, int x1, int x2, ... );
</code></pre>
<p>Was ist da falsch? Da ich ein Anfänger bin, bin ich über jede Hilfe hoch erfreut.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1175760</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1175760</guid><dc:creator><![CDATA[uwerothfeld]]></dc:creator><pubDate>Thu, 16 Nov 2006 10:07:18 GMT</pubDate></item><item><title><![CDATA[Reply to Was bedeutet: Fehler: ISO-C++ verbietet Deklaration von .. on Thu, 16 Nov 2006 10:14:35 GMT]]></title><description><![CDATA[<p>Hallo,<br />
sieht so aus, als wäre A in B.h nicht deklariert. Hast du A.h inkludiert bzw. wenigstens eine Vorwärtsdeklaration von A in B.h?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1175770</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1175770</guid><dc:creator><![CDATA[HumeSikkins]]></dc:creator><pubDate>Thu, 16 Nov 2006 10:14:35 GMT</pubDate></item><item><title><![CDATA[Reply to Was bedeutet: Fehler: ISO-C++ verbietet Deklaration von .. on Thu, 16 Nov 2006 10:21:46 GMT]]></title><description><![CDATA[<p>hi,</p>
<p>ich habe in B stehen:</p>
<pre><code class="language-cpp">#include &quot;game/client/A.h&quot;
</code></pre>
<p>reicht doch, oder? in dem Makefile wird A vor B kompiliert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1175781</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1175781</guid><dc:creator><![CDATA[uwerothfeld]]></dc:creator><pubDate>Thu, 16 Nov 2006 10:21:46 GMT</pubDate></item><item><title><![CDATA[Reply to Was bedeutet: Fehler: ISO-C++ verbietet Deklaration von .. on Thu, 16 Nov 2006 10:27:02 GMT]]></title><description><![CDATA[<p>Und in A.h steht auch ein <code>#include &quot;B.h&quot;</code> , oder? In dem Fall hast du gerade die Grenzen des Präprozessors ausgereizt - und brauchst eine Forward-Deklaration, um A bekanntzumachen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1175788</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1175788</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 16 Nov 2006 10:27:02 GMT</pubDate></item><item><title><![CDATA[Reply to Was bedeutet: Fehler: ISO-C++ verbietet Deklaration von .. on Thu, 16 Nov 2006 10:32:26 GMT]]></title><description><![CDATA[<p>genau steht da,</p>
<p>weil A soll die Möglichkeit haben B zu nutzen, Wie geht das mit der Vorwärtsdekleration???</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1175799</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1175799</guid><dc:creator><![CDATA[uwerothfeld]]></dc:creator><pubDate>Thu, 16 Nov 2006 10:32:26 GMT</pubDate></item><item><title><![CDATA[Reply to Was bedeutet: Fehler: ISO-C++ verbietet Deklaration von .. on Thu, 16 Nov 2006 10:41:59 GMT]]></title><description><![CDATA[<p>Dann mach dir mal klar, was der Präprozessor wirklich macht:</p>
<pre><code class="language-cpp">//A.h
#ifndef A_H
#define A_H

#include &quot;B.h&quot;

class A
{
  B* ptr;
  ...
};

#endif
</code></pre>
<pre><code class="language-cpp">//B.h
#ifndef B_H
#define B_H

#include &quot;A.h&quot;

class B
{
  A* ptr;
  ...
};

#endif
</code></pre>
<pre><code class="language-cpp">//A.cpp
#include &quot;A.h&quot;
...
</code></pre>
<p>-&gt; daraus macht der Präprozessor</p>
<pre><code class="language-cpp">//A.cpp
//A.h
#define A_H

//B.h
#define B_H

//A.h
//hier schlägt das obige #define A_H zu und verhindert, daß A.h nochmal eingebunden wird

class B
{
  A* ptr;
  ...
};
//Ende B.h

class A
{
  B* ptr;
  ...
};
//Ende A.h

...
</code></pre>
<p>Wie du siehst, ist bei der Definition von B A noch nicht bekannt. Um das Problem zu lösen, setzt du anstelle des '#include &quot;A.h&quot;' eine 'class A;' (das ist die erwähnte Forward-Deklaration) und includierst den Header erst in der B.cpp, wenn du nähere Informationen über die Klasse brauchst.</p>
<p>PS: Die #ifndef/#define Konstruktion ist ein Include Guard und verhindert Mehrfacheinbindungen. Wenn du meinst, besonders schlau zu sein (indem du sie weglässt), wird dir der Präprozessor einen Fehler ala &quot;maximale Include-Tiefe überschritten&quot; um die Ohren hauen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1175804</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1175804</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 16 Nov 2006 10:41:59 GMT</pubDate></item><item><title><![CDATA[Reply to Was bedeutet: Fehler: ISO-C++ verbietet Deklaration von .. on Thu, 16 Nov 2006 10:51:51 GMT]]></title><description><![CDATA[<p>hi,</p>
<p>das mit dem class habe ich mir sogar schon fast gedacht. ich habe alles gemacht wie du es gesagt hast, allerdings hat sich das problem nur verschoben, ich bekomme jetzt:</p>
<pre><code class="language-cpp">src/game/client/B.cc: In member function »int B::startUp()«:
src/game/client/B.cc:51: Fehler: expected type-specifier before »A«
src/game/client/B.cc:51: Fehler: »int*« kann nicht nach »A*« in assignment umgewandelt werden
src/game/client/B.cc:51: Fehler: expected `;' before »A«
</code></pre>
<p>ist irgendwie das selbe. mh. trotz das ich in B.h statt des includes auf A jetzt ein class A; stehen habe und das include in <a href="http://B.cc" rel="nofollow">B.cc</a> verschoben habe.</p>
<p>Achso, in der angegebenen Zeile mache ich:</p>
<pre><code class="language-cpp">einA = new A(this,x1,y1,x2,y2);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1175812</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1175812</guid><dc:creator><![CDATA[uwerothfeld]]></dc:creator><pubDate>Thu, 16 Nov 2006 10:51:51 GMT</pubDate></item><item><title><![CDATA[Reply to Was bedeutet: Fehler: ISO-C++ verbietet Deklaration von .. on Thu, 16 Nov 2006 10:57:24 GMT]]></title><description><![CDATA[<p>Erstens: Wo in der <a href="http://B.cc" rel="nofollow">B.cc</a> steht denn der #include? Hoffentlich recht weit am Anfang - sonst nützt er nämlich herzlich wenig.</p>
<p>Edit: Die Forward Deklaration im Header reicht aus, damit der Compiler den Namen 'A' kennt - damit kannst du Pointer und Referenzen zu diesem Typ anlegen und Funktionen deklarieren, die ihn als Parameter oder Rückgabewert verwenden. Wenn du tatsächlich auf die innere Struktur des Typs zurückgreifen mußt (Variablen anlegen, Methoden aufrufen o.ä.), brauchst du die komplette Definition.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1175821</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1175821</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 16 Nov 2006 10:57:24 GMT</pubDate></item><item><title><![CDATA[Reply to Was bedeutet: Fehler: ISO-C++ verbietet Deklaration von .. on Thu, 16 Nov 2006 15:36:47 GMT]]></title><description><![CDATA[<p>hi,</p>
<p>jetzt gehts. da war noch ein kleiner rechtschreibfehler (*hehe peinlich peinlich*), jetzt tut es.</p>
<p>danke für die hilfe. super forum hier.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1175947</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1175947</guid><dc:creator><![CDATA[uwerothfeld]]></dc:creator><pubDate>Thu, 16 Nov 2006 15:36:47 GMT</pubDate></item></channel></rss>