Hey thanks for replying, here are the snippets of the problem files:
Here is the Keys class
Code:
#ifndef AC_KEYS_H_
#define AC_KEYS_H_
/** A key-binding implementation.
* Problems:
* There is a limit to bindings for a key (linked-list?)
* it is experimental, probably won't do it like this
* later on, but for now she works!
*/
#include "types.h"
#include "SDL.h"
/**
* FIXME: I Don't think we want keys to have to talk
* to GameManager, it should be the other way around!
*/
#include "GameManager.h"
typedef int keystate_t;
#define AC_KEY_STATE_DOWN 1
//Up with action associated with
#define AC_KEY_STATE_UP_ACTION 2
//Up, but with no action (resting)
#define AC_KEY_STATE_UP 0
#define AC_LEFT 1
#define AC_RIGHT 2
#define AC_FORWARD 3
#define AC_BACK 4
/** Hold a SDLKey which will hold the actual key pressed, and
* the state of the key.
*/
typedef struct {
SDLKey key;
keystate_t keystate;
} keyent_t;
/** A structure that holds key entries that bind to
* the current required directions and keys for the game.
*/
typedef struct {
keyent_t left;
keyent_t right;
keyent_t forward;
keyent_t back;
} keymap_t;
class Keys
{
keymap_t keymap;
public:
Keys() {}
ac_void initKeys(ac_void);
ac_void handleKeyPress(SDL_keysym keysym);
ac_void handleKeyRelease(SDL_keysym keysym);
ac_void setKeyState(SDLKey, keystate_t keystate);
/**
* Create a key entry that has a specific key
* bound to it.
*
* @param key the SDL defined key value
* @param keystate the integral key state of the key
* @return the newly created keyentry
*/
keyent_t makeKey(SDLKey key, keystate_t keystate);
ac_int getKeyValue(ac_int keyid) const;
ac_boolean isKeyPressed(ac_int keyname) const;
};
#endif
And the GameManager class:
Code:
#ifndef AC_GAMEMANAGER_H_
#define AC_GAMEMANAGER_H_
#ifdef _WINDOWS
#include <windows.h>
#endif
#include <GL/gl.h>
#include <GL/glu.h>
#include <math.h>
#include "SDL.h"
#include "types.h"
#include "UIManager.h"
#include "Error.h"
#include "Camera.h"
#include "Scene.h"
#include "Keys.h"
class GameManager
{
static GameManager *_instance;
UIManager *uimanager;
Camera *camera;
Scene scene;
Keys keys;
ac_int init(ac_void);
ac_void loopGame(ac_void);
ac_void renderScene(ac_void);
public:
static GameManager *instance(ac_void);
ac_void beginGameLoop(ac_void);
Camera *getCamera(ac_void) const { return camera; }
Scene getScene(ac_void) const { return scene; }
Keys getKeys(ac_void) { return keys; }
};
#endif /* AC_GAMEMANAGER_H_ */
Here is the cleaner compiler output:
Code:
cd '/home/max/programming/c++/gl/angelchronicles/angelchronicles/debug' && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" gmake -k -j1
compiling angelchronicles.cpp (g++)
compiling LoadManager.cpp (g++)
compiling UIManager.cpp (g++)
compiling MainFrame.cpp (g++)
compiling Game.cpp (g++)
compiling Error.cpp (g++)
compiling GameManager.cpp (g++)
compiling Prefs.cpp (g++)
compiling version.cpp (g++)
compiling Camera.cpp (g++)
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameSceneRender.h:31: error: ' Camera' is used as a type, but is not defined as a type.
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:44: error: syntax error before `*' token
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:46: error: ' Keys' is used as a type, but is not defined as a type.
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:57: error: syntax error before `*' token
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:58: error: ISO C++ forbids defining types within return type
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:58: error: syntax error before `(' token
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:59: error: parse error before `)' token
compiling Keys.cpp (g++)
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:46: error: ' Keys' is used as a type, but is not defined as a type.
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:59: error: parse error before `)' token
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:60: error: parse error before `}' token
compiling Scene.cpp (g++)
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:44: error: syntax error before `*' token
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:45: error: ' Scene' is used as a type, but is not defined as a type.
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:46: error: ' Keys' is used as a type, but is not defined as a type.
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:57: error: syntax error before `*' token
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:58: error: ISO C++ forbids defining types within return type
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:58: error: syntax error before `(' token
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:59: error: parse error before `)' token
compiling GameSceneRender.cpp (g++)
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/Scene.h:38: error: syntax error before `*' token
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:44: error: syntax error before `*' token
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:46: error: ' Keys' is used as a type, but is not defined as a type.
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:57: error: syntax error before `*' token
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:58: error: ISO C++ forbids defining types within return type
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:58: error: syntax error before `(' token
/home/max/programming/c++/gl/angelchronicles/angelchronicles/src/GameManager.h:59: error: parse error before `)' token
*** Exited with status: 2 ***
Note: This seems to happen with some other classes as well, such as Camera, etc., but the problem seems to be the same as in Keys and GameManager. Any suggestions? Need more code? Thanks!