DO NOT use a line like #include <something.cpp>
You should read the link: http://www.gamedev.net/reference/programming/features/orgfiles/
You only include header files in cpp files and header files. You never include cpp files.
Basically, you put class/struct definitions, function prototypes, global variables(as extern), typedefs, constants, and #defines
in order, this is the stuff above.
header.h
#ifndef HEADER_H#define HEADER_H#include <string> /* we use string, so include it *//* class definition */class CClass { /* or struct in place of class, they're identical in C++ */ private: int private_var;public: CClass(); ~CClass(); int getPrivate();};/* function prototype */void printSomething(const std::string &something);/* global variable */extern int I_AM_EVERY_WHERE;/* typedefinition */typedef CClass aClass;/* constant */const int bad_boy = 10;/* define */#define square(x) x*x#endif
and the associated cpp file header.cpp
#include <iostream> #include <string> /* we use iostream, string and header.h, so include them */#include "header.h"CClass::CClass { private_var = 0; }CClass::~CClass { /* unitialize stuff */ }int CClass::getPrivate() { return private_var; }int I_AM_EVERY_WHERE;/* note how I'm prefixing string, cout, and endl with std::, because * you should avoid using using namespace std; */void printSomething(const std::string &something) { std::cout << something << std::endl;}
And finally, in your main.cpp file you'd do something like this:
#include <iostream>#include <header.h>int main(){ aClass temp; std::cout << "private: " << temp.getPrivate(); << std::endl; return 0;}
There are times when you are including a cpp file in your header file. I'm sure this is causing several problems as the very first error looks like it's coming from tile.h in line 12. there's nothing wrong with this line which means there error comes from earlier. so I looked in last header file you added and looked in location.h
At the bottom of location.h you include location.cpp. So logically I'm going to assume the error is there, but because you shouldn't be including cpp files in header files(or anywhere for that matter) I'm going to tell you to read that link and change your code until you don't include cpp files and then if you're still having problems I'll help.