Jump to content
  • Advertisement
Sign in to follow this  
ajm113

Strange enum error in my struct. (C++ VS2008)

This topic is 3324 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm wondering if this is a compile bug for VS2008 C++, because on my fLane variable in Projectile structure acts like Lane type isn't defined, but it's defined in player.h. I'm not sure if it's the way I placed, my header files, but I only placed header files I need from class and I use precompiled headers for window funcs and etc in the source files.
1>Compiling...
1>Player.cpp
1>c:\users\andrew\desktop\space music windows\thearicle\laser.h(12) : error C2146: syntax error : missing ';' before identifier 'fLane'
1>c:\users\andrew\desktop\space music windows\thearicle\laser.h(12) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\andrew\desktop\space music windows\thearicle\laser.h(12) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\andrew\desktop\space music windows\thearicle\laser.h(26) : error C2065: 'fLane' : undeclared identifier
1>c:\users\andrew\desktop\space music windows\thearicle\laser.h(26) : error C2065: 'CENTER' : undeclared identifier
1>c:\users\andrew\desktop\space music windows\thearicle\laser.h(40) : error C2061: syntax error : identifier 'Lane'
1>laser.cpp
1>c:\users\andrew\desktop\space music windows\thearicle\TheAricle.h(248) : error C2146: syntax error : missing ';' before identifier 'mp_Laser'
1>c:\users\andrew\desktop\space music windows\thearicle\TheAricle.h(248) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\andrew\desktop\space music windows\thearicle\TheAricle.h(248) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\laser.cpp(47) : warning C4018: '<' : signed/unsigned mismatch
1>.\laser.cpp(65) : warning C4305: '-=' : truncation from 'double' to 'float'
1>car.cpp
1>c:\users\andrew\desktop\space music windows\thearicle\laser.h(12) : error C2146: syntax error : missing ';' before identifier 'fLane'
1>c:\users\andrew\desktop\space music windows\thearicle\laser.h(12) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\andrew\desktop\space music windows\thearicle\laser.h(12) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\andrew\desktop\space music windows\thearicle\laser.h(26) : error C2065: 'fLane' : undeclared identifier
1>c:\users\andrew\desktop\space music windows\thearicle\laser.h(26) : error C2065: 'CENTER' : undeclared identifier
1>c:\users\andrew\desktop\space music windows\thearicle\laser.h(40) : error C2061: syntax error : identifier 'Lane'







player.h
#ifndef PLAYER_H
#define PLAYER_H
#include "Camera.h"


enum Lane {
	SHOULDER = 0,
	LEFT,
	CENTER,
	RIGHT
};

//Player Class...

#endif







laser.h
#ifndef LASER_H
#define LASER_H

#include "player.h" 	//Lane Variable
#include "Vector3.h" 	//Vector3 Struct
#include "car.h"

struct Projectile {

	Lane	fLane;
	bool 	fAlive;
	Vector3 fPosition;
	Vector3 fSPosition;
	Vector3 fDirection;

	int	fAttackerId; //0 = No one, 1 = Player, 2 to etc = Foe 

	float	fLife;

	Projectile() {

	fLife  = 2;
	fAlive = false;
	fLane = CENTER;
	fAttackerId = 0;
	fLife = 2;
	}

};

//Laser Class...

#endif




TheAricle.h
#ifndef TheAricle_H
#define TheAricle_H

#include "laser.h"


class Core {

//Private Functions...

public:

// Variables...


	Laser  mp_Laser;
//..
};

#endif


Any ideas or questions? -Ajm

Share this post


Link to post
Share on other sites
Advertisement
Check your headers for circular includes (i.e. header A #includes header B, and header B #includes header A).

Share this post


Link to post
Share on other sites
Always tackle the first error first, ignoring all others, I always say. Fix that one and you're very likely to fix many of the others, or more likely turn them into other ones... ;)

I've seen errors like this if there is a semi-colon missing on the end of a class definition included in a earlier #include. So, I have a heavy suspicion about your Camera.h... could you post it?

Share this post


Link to post
Share on other sites
Tip: in 99.99% of cases, it's not a compiler bug - especially if you're using a modern, well known compiler such as MSVC.

Like others have said, you should check for circular includes.

Share this post


Link to post
Share on other sites
Yep, in my camera .h I also included TheAricle.h which I believe would cause the problems and confusion.

Thanks guys! :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!