There's a lot wrong with that code. First off, you have too many main functions. You only need one, which should be in your main file (game.cpp, in this case). Next, you have a circular include (game.cpp includes game.h, which includes game.cpp, which includes ...). The .cpp files should #include the .h files, never the other way around (#include works as if you had typed the entire included file instead of writing include). Also, you should never define global variables in a header file. Declare them with extern, then define them in a .cpp file.
Here's my verion:
game.h
#include <cstdlib>#include <iostream>#include <cmath>using namespace std;extern int gold;extern int health;
game.cpp
#include "game.h"int gold = 50;int health = 50;int main(){ cout << "how ya doin" << gold << endl; system("pause"); return 0;}
Hope that helps.
-RC
Edit: I don't know how to make code show up in those white boxes. Anybody want to PM me with instructions?
Edit again: Never mind - I figured it out.