Declaration syntax error?

Konobi

Mitglied
Hallo,

ich habe eine kleine Klasse erstellt bekomme jedoch bei Compilieren immer einen "Declaration syntax error", aber ich weis nicht warum! Eigentlich sollte da keiner kommen.

Code:
#include <graphics.h>
class kugeln
{
	private:
		int feindcol(int, int);
		int farbek, radk;
		int col, cxvor, cyvor;
		int cx, cy;
	public:
		void feind();
		kugeln();
		~kugeln();
		void setWerte(int, int, int, int);


};

kugeln::kugeln(){}
kugeln::~kugeln(){}

void kugeln::setWerte(int cxu, int cyu, int rad, int farbe){
   cx=cxu;
   cy=cyu;
   farbek=farbe;
   radk=rad;
}

void kugeln::feind(){

  delay(50);
  int i;
  int rnd;

  setcolor(0);
  circle(cx, cy, radk);

  col=feindcol(cx, cy);
  switch (col){
	case 1: rnd=(random(10)+2); cx+=rnd; cy+=rnd; cxvor=rnd; cyvor=rnd; break;
	case 2: rnd=(random(10)+2); cx-=rnd; cy+=rnd; cxvor=-rnd; cyvor=rnd; break;
	case 3: rnd=(random(10)+2); cx-=rnd; cy-=rnd; cxvor=-rnd; cyvor=-rnd; break;
	case 4: rnd=(random(10)+2); cx+=rnd; cy-=rnd; cxvor=rnd; cyvor=-rnd; break;
	case 0: cx+=cxvor; cy+=cyvor; break;
  }

  setcolor(farbek);

  circle(cx,cy, radk);

  setcolor(3);
}

int kugeln::feindcol(int cirx, int ciry){
   int col=0;
   if (cirx==35)
	col=1;
   else if (ciry==35)
	col=2;
   else if (cirx==605)
	col=3;
   else if (ciry==445)
	col=4;
   else col=0;

   return col;
}

Der Fehler kommt in Zeile 2 und 18. Im Code habe ich sie mal rot makiert! Ich dachte erst es liegt am Namen der Klasse, aber wenn ich ihn ändere kommt immer noch der gleich fehler. Ich benutze den Borland Compiler Turbo C^^

Mit freundlichem Gruß

Konobi
 
Erm, darf ich Fragen warum du so etwas antikes wie Turbo C verwendest? Normalerweise sollte der gar keine Klassen unterstützen (vermute ich einfach mal, hab das nie benutzt), also würde ich dir empfehlen lieber mal Visual Studio Express runter zu laden (kostenlos). Der dürfte dir dann falls wirklich was im code nicht stimmt auch eine wesentlich aussagekräftigere Fehlermeldung liefern.
 
Weil wir leide den Compiler benutzen müssen. Bei anderen Projekten, auch mit dem Compiler, funktionieren die Klassen, aber bei der Klasse kommt immer dieser Fehler.

mfg
 
vielleicht liegt der syntax error eigentlich in der graphics.h (Fehlende Klammer oder Ähnliches).
Die würde ich auch mal durchschauen, denn ich seh da so direkt keinen Syntax Fehler.
 
Zurück