Basically, you create a library version of your game engine (everything except the main() you used to test the game engine). This you call for example mygameengine.lib.
Along side that, you also have mygameengine.h which is the API of your masterpiece.
Then newgame.cpp would be
Code:
#include "mygameengine.h"
int main ( ) {
// do stuff
}
Finally
g++ newgame.cpp mygameengine.lib
to compile your new game with your library.
The syntax for creating and using libraries varies from one compiler to the next, so if you get stuck say what you have.