Original Post
What I am doing is creating a program that, when run, will let you choose between several different, very simple games (a few hundred lines of code each). What I want to do is have a .cpp and .h file for each of the separate games. I don't want to use classes for the games' functions, so what I was going to do is put the function declarations in the .h files and the definitions in the .cpp file, but I keep getting all sorts of errors when I do this, like: error C2871: 'std' : does not exist or is not a namespace, error C2065: 'string' : undeclared identifier, error C2143: syntax error : missing ';' before '{', and error C2447: missing function header (old-style formal list?). Here is how a generic version of what I used looked. Most of the errors are coming from the header. Do I have to put the functions in classes if I want to separate them from the definitions?
//Game1.h
#ifndef GAME1_H
#define GAME1_H
void GetInfo(string & name, int & explorers, int & killed, int & survivors);
void GameFunction(string & name, int & explorers, int & killed, int & survivors);
#endif GAME1_H
//Game1.cpp
#include <string>
#include <iostream>
#include "Game1.h"
using namespace std;
void GetInfo(string & name, int & explorers, int & killed, int & survivors)
{
//definition
}
void GameFunction(string & name, int & explorers, int & killed, int & survivors)
{
//definition
}
//Main.cpp
#include "TreasureHunt.h"
int main()
{
return 0;
}