C2143: Missing ';' before '*'

Dec 27, 2009 at 4:25pm
Hallo,

I've had a look online and I can't seem to find any solutions to this problem (bet you've heard that one before).

I'm getting this error
"Cloud.h(50) : error C2143: syntax error : missing ';' before '*'"

Cloud.h >
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 _CLOUD_H
#define	_CLOUD_H

#include "DynObj.h"
#include "Glider.h"
#include "Rain.h"


class Cloud: public DynObj
{
public:
    Cloud();

    ~Cloud();

    void Update();
	void Initialise(double dPosX1,double dPosY1,double dPosX2,double dPosY2);
    double GetNimbus();
	double ProcessPosition(Glider* player);
	Rect* m_pRect;
	Terrain* m_pTerrain;
	Rain* m_pRain;
	double m_dSlope;

private:
    void Rain();

    bool m_bPrecip;
    double m_dNimbus;

};

#endif	/* _CLOUD_H */


Rain.h >
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef _RAIN_H
#define _RAIN_H

#include "engine.h"

class Rain
{
public:
	Rain();

	~Rain();

	void Initialise(double dPosX,double dPosY);

	void Activate(Vector2D* pvPos);

	void Deactivate();

	Sprite* m_psRain;

};

#endif /*_RAIN_H*/ 


I've checked every other header for a missing semicolon, but can't seem to find anything, and the code compiles and works fine if I remove the "Rain* m_pRain;" and all the relevant Rain bits. Am I missing something really obvious?

Many Thanks!
Dec 27, 2009 at 4:32pm
I think the problem is that you have void Rain(); inside Cloud, that could cause ambiguities
Dec 27, 2009 at 4:36pm
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
class Cloud: public DynObj
{
public:
    Cloud();

    ~Cloud();

    void Update();
	void Initialise(double dPosX1,double dPosY1,double dPosX2,double dPosY2);
    double GetNimbus();
	double ProcessPosition(Glider* player);
	Rect* m_pRect;
	Terrain* m_pTerrain;
	Rain* m_pRain;
	double m_dSlope;

private:
    void Rain();//This line might clash  with the Rain class

    bool m_bPrecip;
    double m_dNimbus;

};

#endif	/* _CLOUD_H */ 
Dec 27, 2009 at 4:48pm
That solved it =) Thank you!

I had originally commented it out to see if that was the problem, and it didn't work, but I got rid of the virtual functions from the parent classes and it worked.

Thanks again!
Topic archived. No new replies allowed.