hallo erstmal,
so erstmal mein Fehler
|
C-/C++-Quelltext
|
1
2
3
4
|
1>c:\dokumente und einstellungen\raphi\desktop\pixelbased\pixelbased\main.cpp(4) : error C2143: Syntaxfehler: Es fehlt ';' vor '.'
1>c:\dokumente und einstellungen\raphi\desktop\pixelbased\pixelbased\main.cpp(4) : error C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht unterstützt.
1>c:\dokumente und einstellungen\raphi\desktop\pixelbased\pixelbased\main.cpp(4) : error C2371: 'g_Powerup': Neudefinition; unterschiedliche Basistypen
1> c:\dokumente und einstellungen\raphi\desktop\pixelbased\pixelbased\main.cpp(3): Siehe Deklaration von 'g_Powerup'
|
schön, daraus kann man ja schließen dass irgendetwas nich richtig included is aber ich komm einfach nich darauf....so hier mal mein Code
main.cpp
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
|
#include "main.h"
CPowerup g_Powerup;
g_Powerup.Init();
// Bla bla......
|
main.h
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#ifndef main_h
#define main_h
//includes
#include <windows.h>
#include <commctrl.h>
#include <d3d9.h>
#include <fstream>
#include <d3dx9.h>
#include <string>
using namespace std;
enum EPaddleState
{
PS_NONE,
PS_SMALLER,
PS_BIGGER,
PS_FASTER,
PS_ULTRA,
PS_ADD,
PS_SUB,
PS_SLOWER
};
#include "CApplication.h"
#include "d3ddefs.h"
#include "CSprite.h"
#include "CPowerup.h"
#include "Ball.h"
#include "Paddle.h"
// bla bla
#endif
|
Cpowerup.h
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#ifndef POWERUP_H
#define POWERUP_H
#include "main.h"
class CSprite;
class CPowerup
{
public:
void Init();
void Render();
bool Alive() { return m_bAlive; }
void SetAlive(bool alive) { m_bAlive = alive; }
void SetState(EPaddleState state) { m_State = state;}
private:
EPaddleState m_State;
bool m_bAlive;
CSprite *m_Sprite;
LPDIRECT3DTEXTURE9 m_PowerupPicture[10];
};
#endif
|
so müsste ja alles richtig sein oder?
genauso hab ich es auch mit meiner Ball Klasse gemacht und die funktioniert so :
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#ifndef BALL_H
#define BALL_H
#include "main.h"
class CPaddle;
class CSprite;
class CBall
{
public:
void Init(float xpos, float ypos);
void Update(float fTime);
void Render(float fTime);
float GetPositionX() {return m_fXPos;}
float GetPositionY() {return m_fYPos;}
void SetPositionX(float fwertx) { m_fXPos = fwertx; }
void SetPositionY(float fwerty) { m_fYPos = fwerty; }
bool alive() {return m_bActive;}
private:
float m_fSpeed;
double m_dRotation;
void CheckCollision(CPaddle &Paddle, float _fTime);
D3DVERTEX Rect[4];
bool m_bActive;
float m_fXPos, m_fYPos;
CSprite *m_Sprite;
};
#endif
|
hat einer ne ahnung wieso die Powerup Klasse mit den includes so nich funktioniert?