<?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[Unklare CompilerFehlerMeldung]]></title><description><![CDATA[<p>Hallo follgendes Problem</p>
<p>ich habe eine abstrakte Klasse State.h<br />
Habe nur .h Datei angelegt.</p>
<pre><code class="language-cpp">#ifndef STATE_H
#define STATE_H

#include &quot;../impl/Automat.h&quot;

class State {

protected:
	bool final;

public:
	virtual ~State() =0;
	/**
	 * Gibt 1 zurueck, wenn der Zustand ein
	 * Endzustand ist, sonst 0.
	 */
	bool isFinal() {
		return final;
	}

	virtual void read(char c, Automat* m) = 0;

};

#endif /* STATE_H */
</code></pre>
<p>Dann habe ich viele UnterKlassen States von 0 bis 10.<br />
Hier ist State0</p>
<pre><code class="language-cpp">#ifndef STATE0_H_
#define STATE0_H_

#include &quot;../../abstract/State.h&quot;

class State0 : public State { // FEHLER: expected class-name before '{' token

public:
	State0();
	virtual ~State0();
	void read(char c, Automat* m); //FEHLER: ISO C++ forbids declaration of `m' with no type
};

#endif /* STATE0_H_ */
</code></pre>
<p>Dann habe ich noch eine Klasse Automat<br />
Hier ist .h</p>
<pre><code class="language-cpp">#ifndef AUTOMATIMPL_H_
#define AUTOMATIMPL_H_

#include &quot;../abstract/State.h&quot;
#include &quot;../impl/states/State0.h&quot;
#include &quot;../impl/states/State1.h&quot;
#include &quot;../impl/states/State2.h&quot;
#include &quot;../impl/states/State3.h&quot;
#include &quot;../impl/states/State4.h&quot;
#include &quot;../impl/states/State5.h&quot;
#include &quot;../impl/states/State6.h&quot;
#include &quot;../impl/states/State7.h&quot;
#include &quot;../impl/states/State8.h&quot;
#include &quot;../impl/states/State9.h&quot;
#include &quot;../impl/states/State10.h&quot;

class State;

class Automat{
protected:
	/** Der aktuelle Zustand des Automats. */
	State* currentState;
	/*enthaelt Zeiger auf alle 11 Zustaende*/
	State* statePool;

public:
	Automat();
	virtual ~Automat();

	/**
	 * Liest und bearbeitet ein Zeichen.
	 */
	void readChar(char);

};

#endif /* AUTOMATIMPL_H_ */
</code></pre>
<p>Jetzt bekomme ich Fehler Meldung in allen State0.h bis State10.h und zwar immer an der gleichen stellen. Siehe oben State0.h Zeilen 6 und 11.</p>
<p>Kann bitte jemand erklären was ich da falsch mache?</p>
<p>Danke schon mal.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/267157/unklare-compilerfehlermeldung</link><generator>RSS for Node</generator><lastBuildDate>Wed, 02 Sep 2026 15:12:28 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/267157.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 May 2010 20:18:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Unklare CompilerFehlerMeldung on Wed, 19 May 2010 20:42:30 GMT]]></title><description><![CDATA[<p>Hallo follgendes Problem</p>
<p>ich habe eine abstrakte Klasse State.h<br />
Habe nur .h Datei angelegt.</p>
<pre><code class="language-cpp">#ifndef STATE_H
#define STATE_H

#include &quot;../impl/Automat.h&quot;

class State {

protected:
	bool final;

public:
	virtual ~State() =0;
	/**
	 * Gibt 1 zurueck, wenn der Zustand ein
	 * Endzustand ist, sonst 0.
	 */
	bool isFinal() {
		return final;
	}

	virtual void read(char c, Automat* m) = 0;

};

#endif /* STATE_H */
</code></pre>
<p>Dann habe ich viele UnterKlassen States von 0 bis 10.<br />
Hier ist State0</p>
<pre><code class="language-cpp">#ifndef STATE0_H_
#define STATE0_H_

#include &quot;../../abstract/State.h&quot;

class State0 : public State { // FEHLER: expected class-name before '{' token

public:
	State0();
	virtual ~State0();
	void read(char c, Automat* m); //FEHLER: ISO C++ forbids declaration of `m' with no type
};

#endif /* STATE0_H_ */
</code></pre>
<p>Dann habe ich noch eine Klasse Automat<br />
Hier ist .h</p>
<pre><code class="language-cpp">#ifndef AUTOMATIMPL_H_
#define AUTOMATIMPL_H_

#include &quot;../abstract/State.h&quot;
#include &quot;../impl/states/State0.h&quot;
#include &quot;../impl/states/State1.h&quot;
#include &quot;../impl/states/State2.h&quot;
#include &quot;../impl/states/State3.h&quot;
#include &quot;../impl/states/State4.h&quot;
#include &quot;../impl/states/State5.h&quot;
#include &quot;../impl/states/State6.h&quot;
#include &quot;../impl/states/State7.h&quot;
#include &quot;../impl/states/State8.h&quot;
#include &quot;../impl/states/State9.h&quot;
#include &quot;../impl/states/State10.h&quot;

class State;

class Automat{
protected:
	/** Der aktuelle Zustand des Automats. */
	State* currentState;
	/*enthaelt Zeiger auf alle 11 Zustaende*/
	State* statePool;

public:
	Automat();
	virtual ~Automat();

	/**
	 * Liest und bearbeitet ein Zeichen.
	 */
	void readChar(char);

};

#endif /* AUTOMATIMPL_H_ */
</code></pre>
<p>Jetzt bekomme ich Fehler Meldung in allen State0.h bis State10.h und zwar immer an der gleichen stellen. Siehe oben State0.h Zeilen 6 und 11.</p>
<p>Kann bitte jemand erklären was ich da falsch mache?</p>
<p>Danke schon mal.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1899838</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1899838</guid><dc:creator><![CDATA[Dit_]]></dc:creator><pubDate>Wed, 19 May 2010 20:42:30 GMT</pubDate></item><item><title><![CDATA[Reply to Unklare CompilerFehlerMeldung on Wed, 19 May 2010 20:34:33 GMT]]></title><description><![CDATA[<p>sieht etwas verstreuselt aus.</p>
<p>Du bindest deine State-Header in die Automat-Header ein und dann in der State-Header nochmal die Automat-Header genau wie in jeder StateX-Header <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/26a0.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--warning"
      title=":warning:"
      alt="⚠"
    /></p>
<p>Des verwirrt nicht nur mich sondern auch deinen Compiler <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>Die Header in der Automat machen irgendwie erstmal keinen Sinn. Du machst ja da eh schon ne Vorwärtsdeklaration deiner State. Schau mal, obs dann schon geht. <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/1899846</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1899846</guid><dc:creator><![CDATA[BasicMan01]]></dc:creator><pubDate>Wed, 19 May 2010 20:34:33 GMT</pubDate></item><item><title><![CDATA[Reply to Unklare CompilerFehlerMeldung on Wed, 19 May 2010 20:41:02 GMT]]></title><description><![CDATA[<p>Das mache ich weil in meinem Automat alle Zustaende erstmal erstellt werden;</p>
<pre><code class="language-cpp">void Automat::initAutomat(){

	//init States
	this-&gt;statePool 	= new State[11];

	this-&gt;statePool[0]  = new State0();
	this-&gt;statePool[1]  = new State1();
	this-&gt;statePool[2]  = new State2();
	this-&gt;statePool[3]  = new State3();
	this-&gt;statePool[4]  = new State4();
	this-&gt;statePool[5]  = new State5();
	this-&gt;statePool[6]  = new State6();
	this-&gt;statePool[7]  = new State7();
	this-&gt;statePool[8]  = new State8();
	this-&gt;statePool[9]  = new State9();
	this-&gt;statePool[10] = new State10();

	setCurrentState(0);

}
</code></pre>
<p><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/1899848</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1899848</guid><dc:creator><![CDATA[Dit_]]></dc:creator><pubDate>Wed, 19 May 2010 20:41:02 GMT</pubDate></item><item><title><![CDATA[Reply to Unklare CompilerFehlerMeldung on Wed, 19 May 2010 20:53:31 GMT]]></title><description><![CDATA[<p>versuche nachzuvollziehen, in welcher Reihenfolge die Header in den verschiedenen Klassen eingebunden werden. Bedenke dabei, dass durch die Präprozessordirektiven dies nur einmal geschieht.</p>
<p>class State wird vor class Automat eingebunden &gt; Vorwärtsdeklaration dann also hier unnötig. In State.h ist Automat also nicht bekannt, drum müsste dann hier die Klasse vorher bekannt gemacht werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1899853</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1899853</guid><dc:creator><![CDATA[BasicMan01]]></dc:creator><pubDate>Wed, 19 May 2010 20:53:31 GMT</pubDate></item></channel></rss>