.h include .cpp with functions

I know this may seem a bit redundant, but is there and way I can get this to work:
game.h
1
2
3
4
5
6
7
8
9
10
11
#ifndef _GAME_H_
    #define _GAME_H_

#include <SDL/SDL.h>
#include "game.cpp"

class game {
//functions
};

#endif 

game.cpp
1
2
game::game() : bisrunning(true) {
}



without doing:
game.h
1
2
3
4
5
6
7
8
9
10
#ifndef _GAME_H_
    #define _GAME_H_

#include <SDL/SDL.h>

class game {
//functions
};

#endif 

game.cpp

1
2
3
4
#include "game.h"

game::game() : bisrunning(true) {
}
Last edited on
No, game.cpp will need to include game.h to understand the class definition.

You don't, however, need to include game.cpp in game.h. Generally, you never really want to include a cpp file.
Thanks for the help. :D
Topic archived. No new replies allowed.