   multiple def error
  I keep getting this multiple def error and I have no idea why.Here is my code:<Engine.h>//This is the skeleton for the engine.#ifndef ENGINE_H#define ENGINE_H#include "SDL/SDL.h"#include "SDL/SDL_image.h"#include <string>using namespace std;//gobal variables//Screen that everything goes ontoSDL_Surface *screen;//Event handlerSDL_Event event;//Init functions//Initiates SDL and prepares for the long journeybool init(int, int, int, string);//load image into SDLSDL_Surface *load_image(string);//Apply surface to screenvoid apply_surface(int, int, SDL_Surface*, SDL_Surface*);//Check for collision#endif<Engine.cpp>#include "Engine.h"bool init(int width, int height, int bpp, string caption){  if(SDL_Init(SDL_INIT_EVERYTHING) < 0)    { return false;    }  screen = SDL_SetVideoMode(width,height,bpp,SDL_SWSURFACE);  if(screen == NULL)    { return false;    }  SDL_WM_SetCaption(caption.c_str(),NULL);    return true;}//Load Image into SDLSDL_Surface *load_image(string filename){  //Temp storage for the image that's loaded  SDL_Surface *loadedImage = NULL;  //The optimized image that will be used  SDL_Surface *optimizedImage = NULL;  //Load the image  loadedImage = IMG_Load(filename.c_str());  //If nothing went wrong in loading the image  if(loadedImage != NULL)    { //Create an optimized image optimizedImage = SDL_DisplayFormat(loadedImage); //Free the old image SDL_FreeSurface(loadedImage);    }  return optimizedImage;}//Place given surface onto desination//meant to put layers onto the screen//x and y are offsetsvoid apply_surface(int x, int y, SDL_Surface *source, SDL_Surface *dest){  SDL_Rect offset;  offset.x = x;  offset.y = y;  SDL_BlitSurface(source,NULL,dest, &offset);}<MAIN>#include "Engine.h"using namespace std;int main(int argc, char** argv){SDL_Surface *hello = NULL;bool quit = false;if(!init(640,480,32,"Gaia")){return 1;}if(!(hello = load_image("babystep.bmp"))){return 1;}//While there are events to handlewhile(!quit){while(SDL_PollEvent(&event)){//If the 'x' is clicked//to prevent crashingif(event.type == SDL_QUIT){quit = true;}}//end of event pollUint8 *keystates = SDL_GetKeyState(NULL);//check to see if keystates are workingif(keystates[SDLK_v]){apply_surface(0,0,hello,screen);}//end of keystate check//Refresh the screenif(SDL_Flip(screen) == -1){return 1;}//end of refresh}//end of quitSDL_FreeSurface(hello);SDL_Quit();return 0;}<makefile>compile: Gaia.o Engine.og++ Engine.o Gaia.o -o Gaia -lSDL -lSDL_imageGaia.o: Gaia.cpp Engine.hg++ -c Gaia.cpp -lSDL -lSDL_imageEngine.o: Engine.h Engine.cppg++ -c Engine.cpp-lSDL -lSDL_imageclean:rm *.orun:./Gaia
  Is there any chance you could post the errors? It compiles fine for me...   ;  When you use global variables in header files they must be declared extern and in one source file, at namespace scope (not inside a function or class definition) they must be defined. For more details see  this.   ;  When you have an #include statement somewhere, what the compiler does is that it actually replaces the #include statement with entire content of the the included file.This means that your definitions:SDL_Surface *screen;SDL_Event event;Will actually be pasted into both Engine.cpp and your main cpp file. When the compiler then tries to link the Engine.o object file with the object file of your main file, it finds that the same variable has been defined twice and don't know what to do.This is resolved by instead of having variable definitions in Engine.h, you prefix them with extern keyword as such, making them into variable declarations:extern SDL_Surface *screen;extern SDL_Event event;This will tell the compiler: "These are defined someplace else, just take my word for it that they will exist and you can use them".Then in one cpp file, it doesn't really matter which one, you put the actual definitions:SDL_Surface *screen;SDL_Event event;For a detailed explanation, see this article. Specifically, you want to read the section Fixing Problem 4.   