<?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[ISO C++ forbids declaration of &#x27;...&#x27;  with no type]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich bekomme folgende Fehler den ich nicht versteh...</p>
<blockquote>
<p>6 C:\Dev-Cpp\GUI_Server\user.h:5, from base.h In file included from user.h:5, from base.h<br />
1 C:\Dev-Cpp\GUI_Server\base.h:6, from base.cpp from base.h:6, from base.cpp<br />
1 C:\Dev-Cpp\GUI_Server\base.cpp from base.cpp<br />
115 C:\Dev-Cpp\GUI_Server\GUI_ServerFrm.h ISO C++ forbids declaration of <code>User' with no type 115 C:\\Dev-Cpp\\GUI\_Server\\GUI\_ServerFrm.h expected</code>;' before '<em>' token<br />
116 C:\Dev-Cpp\GUI_Server\GUI_ServerFrm.h ISO C++ forbids declaration of <code>Base' with no type 116 C:\\Dev-Cpp\\GUI\_Server\\GUI\_ServerFrm.h expected</code>;' before '</em>' token<br />
C:\Dev-Cpp\GUI_Server\Makefile.win [Build Error] [base.obj] Error 1 ,</p>
</blockquote>
<p>Ich habe zwei Klassen User und Base. Diese möchte ich nun in einer anderen Klasse nutzen (GUI_ServerFrm). Die Headerdateien der beiden klassen sind über include eingebunden.<br />
In der GUI_ServerFrm.h definiere ich mir zwei public Variablen mit denen ich dann arbeiten möchte.</p>
<pre><code class="language-cpp">public:
       .....
       wxTimer *m_timer;
       wxTimer *m_timer2;
115    User *pUsers[CUSTOMERS];       
116    Base *pBS;
       int d;  //day 
       int t;  //time(time in seconds) 
       .....
</code></pre>
<p>Hab schon gegoogelt, aber so richtig nichts gefunden. wenn ich das richtig versteh, könnte es irgendwas mit namespace zu tun haben!?</p>
<p>Kann mir bitte jemand helfen diesen Fehler zu beseitigen...</p>
<p>Danke &amp; Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/169651/iso-c-forbids-declaration-of-with-no-type</link><generator>RSS for Node</generator><lastBuildDate>Wed, 16 Sep 2026 19:45:05 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/169651.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 07 Jan 2007 14:12:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ISO C++ forbids declaration of &#x27;...&#x27;  with no type on Sun, 07 Jan 2007 14:12:17 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich bekomme folgende Fehler den ich nicht versteh...</p>
<blockquote>
<p>6 C:\Dev-Cpp\GUI_Server\user.h:5, from base.h In file included from user.h:5, from base.h<br />
1 C:\Dev-Cpp\GUI_Server\base.h:6, from base.cpp from base.h:6, from base.cpp<br />
1 C:\Dev-Cpp\GUI_Server\base.cpp from base.cpp<br />
115 C:\Dev-Cpp\GUI_Server\GUI_ServerFrm.h ISO C++ forbids declaration of <code>User' with no type 115 C:\\Dev-Cpp\\GUI\_Server\\GUI\_ServerFrm.h expected</code>;' before '<em>' token<br />
116 C:\Dev-Cpp\GUI_Server\GUI_ServerFrm.h ISO C++ forbids declaration of <code>Base' with no type 116 C:\\Dev-Cpp\\GUI\_Server\\GUI\_ServerFrm.h expected</code>;' before '</em>' token<br />
C:\Dev-Cpp\GUI_Server\Makefile.win [Build Error] [base.obj] Error 1 ,</p>
</blockquote>
<p>Ich habe zwei Klassen User und Base. Diese möchte ich nun in einer anderen Klasse nutzen (GUI_ServerFrm). Die Headerdateien der beiden klassen sind über include eingebunden.<br />
In der GUI_ServerFrm.h definiere ich mir zwei public Variablen mit denen ich dann arbeiten möchte.</p>
<pre><code class="language-cpp">public:
       .....
       wxTimer *m_timer;
       wxTimer *m_timer2;
115    User *pUsers[CUSTOMERS];       
116    Base *pBS;
       int d;  //day 
       int t;  //time(time in seconds) 
       .....
</code></pre>
<p>Hab schon gegoogelt, aber so richtig nichts gefunden. wenn ich das richtig versteh, könnte es irgendwas mit namespace zu tun haben!?</p>
<p>Kann mir bitte jemand helfen diesen Fehler zu beseitigen...</p>
<p>Danke &amp; Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1204988</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204988</guid><dc:creator><![CDATA[fub0815]]></dc:creator><pubDate>Sun, 07 Jan 2007 14:12:17 GMT</pubDate></item><item><title><![CDATA[Reply to ISO C++ forbids declaration of &#x27;...&#x27;  with no type on Sun, 07 Jan 2007 14:25:19 GMT]]></title><description><![CDATA[<p>wenn ich die '*' wegnehme ändert sich die Fehlermeldung wie folgt:</p>
<blockquote>
<p>6 C:\Dev-Cpp\GUI_Server\user.h:5, from base.h In file included from user.h:5, from base.h<br />
1 C:\Dev-Cpp\GUI_Server\base.h:6, from base.cpp from base.h:6, from base.cpp<br />
1 C:\Dev-Cpp\GUI_Server\base.cpp from base.cpp<br />
115 C:\Dev-Cpp\GUI_Server\GUI_ServerFrm.h <code>User' does not name a type 116 C:\\Dev-Cpp\\GUI\_Server\\GUI\_ServerFrm.h</code>Base' does not name a type<br />
C:\Dev-Cpp\GUI_Server\Makefile.win [Build Error] [base.obj] Error 1</p>
</blockquote>
<p>Danke &amp; Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1205004</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1205004</guid><dc:creator><![CDATA[fub0815]]></dc:creator><pubDate>Sun, 07 Jan 2007 14:25:19 GMT</pubDate></item><item><title><![CDATA[Reply to ISO C++ forbids declaration of &#x27;...&#x27;  with no type on Sun, 07 Jan 2007 14:26:57 GMT]]></title><description><![CDATA[<p>Dem Compiler sind die Typen User und Base nicht bekannt. Die Feldermeldung aus deniem ersten Post kannst du dir so erklären, dass man in Prästandardzeiten teilweise den Typ einer Variablen weglassen konnte, wenns ein int war.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1205007</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1205007</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Sun, 07 Jan 2007 14:26:57 GMT</pubDate></item><item><title><![CDATA[Reply to ISO C++ forbids declaration of &#x27;...&#x27;  with no type on Sun, 07 Jan 2007 14:29:56 GMT]]></title><description><![CDATA[<p>aber warum nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /><br />
ich hab doch in der GUI_ServerFrm.h</p>
<pre><code class="language-cpp">#include &quot;user.h&quot;
#include &quot;base.h&quot;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1205011</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1205011</guid><dc:creator><![CDATA[fub0815]]></dc:creator><pubDate>Sun, 07 Jan 2007 14:29:56 GMT</pubDate></item><item><title><![CDATA[Reply to ISO C++ forbids declaration of &#x27;...&#x27;  with no type on Sun, 07 Jan 2007 14:32:48 GMT]]></title><description><![CDATA[<p>Wie sehen denn die Definitionen aus?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1205015</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1205015</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Sun, 07 Jan 2007 14:32:48 GMT</pubDate></item><item><title><![CDATA[Reply to ISO C++ forbids declaration of &#x27;...&#x27;  with no type on Sun, 07 Jan 2007 14:36:47 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#ifndef USER_H
#define USER_H USER_H

#include &lt;wx/wx.h&gt;
#include &quot;GUI_ServerFrm.h&quot;
#include &quot;myDB.h&quot;

class User
{
 public:
  User() {

		bmax=MAX;

		//kann weg
		for( int j=0; j&lt; 30; j++ ) {
			for( int i=0; i&lt; TIMEUNITS; i++ ) {
				history[j][i]=0;
				resend[j][i]=0;
				usage[j][i]=0;
				base_valuation[j][i]=0;
				real_valuation[j][i]=0;
			}
		}

		//Tabellen je User generieren
		myDB* db=new myDB();
		wxString query;
		query=&quot;create table traffic_user_&quot;+User_ID+&quot; (date datetime, traffic int, PRIMARY KEY(date))&quot;;
		db-&gt;einfuegen(query);
		query=&quot;create table purch_power_user_&quot;+User_ID+&quot; (date datetime, purch_power int, primary key(date))&quot;;
		db-&gt;einfuegen(query);
		query=&quot;create table transmissionrate_user_&quot;+User_ID+&quot; (date datetime, trans_rate int, primary key(date))&quot;;
		db-&gt;einfuegen(query);
		query=&quot;create table behavior_user_&quot;+User_ID+&quot; (date datetime, defl char(1), coop char(1), primary key(date))&quot;;
		db-&gt;einfuegen(query);

		delete db;

  }

  int generateData( int d, int t );

  long getPower() { return power; }
  bool setPower(long p) { power=p; return true; }
  long getBmax( int d, int t, double gamma);
  long getBavg( int d, int t ) { return t&lt;0 ? usage[d][0] : history[d][t]; }

  bool setPrice( double p, double l ) { currentPrice=p; currentLoad=l; return true; }

  long calculateAllowed() { (long)(power/currentPrice)&gt;bmax ? allowed=bmax : allowed=(long)((double)power/(double)currentPrice) ; return allowed; }
  long calculateDemand( int d, int t);

  long setHistory( int d, int t, int val ) { history[d][t] = val; return val; }
  long getHistory( int d, int t ) { return history[d][t]; }

  long getUtility( int d, int t ) { return real_valuation[d][t] * history[d][t]; }

  int getBaseValuation( int d, int t ) { return base_valuation[d][t]; }
  int getRealValuation( int d, int t ) { return real_valuation[d][t]; }
  int setRealValuation( int d, int t, int val ) { if(val&lt;0)val=0; real_valuation[d][t]=val; return real_valuation[d][t]; }

  long setResend( int d, int t, int val ) { resend[d][t] = val; return val; }
  long getResend( int d, int t ) { return resend[d][t]; }

  long base_valuation[30][TIMEUNITS];
  long usage[30][TIMEUNITS];
  double coop;

  bool setUser_ID(wxString UserID) {User_ID=UserID; return true;}
  wxString getUser_ID(){return User_ID;}
  int cur_traffic;

 private:

  long power;
  long allowed;
  long bmax;
  double currentPrice;
  double currentLoad;
  long real_valuation[30][TIMEUNITS];
  long history[30][TIMEUNITS];
  long resend[30][TIMEUNITS];
  wxString User_ID;

};

#endif
</code></pre>
<p>und</p>
<pre><code class="language-cpp">#ifndef BASE_H
#define BASE_H BASE_H

#include &lt;wx/wx.h&gt;
#include &quot;myDB.h&quot;
#include &quot;user.h&quot;
#include &quot;GUI_ServerFrm.h&quot;

class Base
{
 public:
  Base(int max_bw, int type) {
           price = 1; 
           clients=0; 
           gamma=1; 
           mode=type; 

           //allgemeine Tabellen anlegen
           myDB* db=new myDB();
		   wxString query;
		   query=&quot;create table ap (ap_id int, cur_user int, transmission_capacity float,loc_name varchar(45), loc_street varchar(45), loc_postal varchar(45),loc_country varchar(45), max_user int , PRIMARY KEY(ap_id))&quot;;
		   db-&gt;einfuegen(query);
		   query=&quot;create table marketprice (date datetime, price float, primary key(date))&quot;;
		   db-&gt;einfuegen(query);
		   query=&quot;create table rel_ap_user (ap_id int, user_id int)&quot;;
		   db-&gt;einfuegen(query);

  }

  double calculatePrice( int d, int t );
  double broadcastPrice();
  bool calculatePowers();
  bool registerUser(User *newbie);
  int clientNumber() { return clients; }
  User* clientInfo( int id ) { return registry[id]; }
  bool shapeTraffic( int d, int t);

 private:
  int get_max (double bids[]);

  double price;
  double load;
  double price_t[TIMEUNITS];
  int mode;
  int clients;
  double gamma;
  User* registry[CUSTOMERS];

};

#endif
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1205019</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1205019</guid><dc:creator><![CDATA[fub0815]]></dc:creator><pubDate>Sun, 07 Jan 2007 14:36:47 GMT</pubDate></item><item><title><![CDATA[Reply to ISO C++ forbids declaration of &#x27;...&#x27;  with no type on Mon, 08 Jan 2007 07:16:32 GMT]]></title><description><![CDATA[<p>Du hast da eine gegenseitige Abhängigkeit zwischen den Headern eingebaut - &quot;GUI_ServerFrm.h&quot; inkludiert &quot;User.h&quot; und &quot;Base.h&quot; und diese binden wiederum GUI_ServerFrm.h&quot; ein. Und an der Stelle bewirken die Inklude-Guards, daß die Definition von User bzw. Base erst <strong>hinter</strong> der Server-Klasse stehen.</p>
<p>(PS: Wenn du aus dem Gesagten noch nicht auf die Lösung gekommen bist - die nennt sich &quot;Forward Deklaration&quot;)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1205394</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1205394</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Mon, 08 Jan 2007 07:16:32 GMT</pubDate></item><item><title><![CDATA[Reply to ISO C++ forbids declaration of &#x27;...&#x27;  with no type on Mon, 08 Jan 2007 07:59:46 GMT]]></title><description><![CDATA[<p>BTW: USER_H und BASE_H sind nicht gerade gute Namen für include Guards...<br />
Genauso wie man Namespaces verwenden sollte, sollte man include Guards mit dem Namespace Namen oder dem Projektnamen prefixen...</p>
<p>Und &quot;#define USER_H USER_H&quot; ist etwas ungewöhnlich - da schreibt man normalerweise auch bloss &quot;#define USER_H&quot;.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1205405</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1205405</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Mon, 08 Jan 2007 07:59:46 GMT</pubDate></item><item><title><![CDATA[Reply to ISO C++ forbids declaration of &#x27;...&#x27;  with no type on Mon, 08 Jan 2007 10:07:20 GMT]]></title><description><![CDATA[<p>Danke erstmal für die Hinweise!<br />
Hatte mir schon gedacht das es an den gegenseitigen abhängigkeiten liegen würde...<br />
Hab es jetzt aber erstmal anders geöst in dem ich die Abhängigkeiten entfernt habe, waren eh nur da, da ich in der GUI_ServerFrm.h Konstanten definiert habe die in den anderen auch benötigt werden. Wollte das wenn halt nur an einer stelle ändern müssen, jetzt muss ichs halt mehrfach ändern.<br />
Das mit der Forward Declaration hab ich noch nicht ganz verstanden, muss ich mal bischen genauer nachforschen.<br />
Auf jedenfall compilliert er jetzt fehlerfrei!</p>
<p>Danke &amp; Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1205514</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1205514</guid><dc:creator><![CDATA[fub0815]]></dc:creator><pubDate>Mon, 08 Jan 2007 10:07:20 GMT</pubDate></item></channel></rss>