   Redefinition of 'function name'
  This is confusing the heck outta me. I can't figure out how to fix these linker errors, as I've already done the "no def" trick.gui.cpp#include "gui.h"#include "game.h"extern cGUI* client;#ifdef _DEBUG_CLIENT_   #include "error.h"   extern DebugIO* error;#endif//codegame.cpp#include <gl/gl.h>#include <gl/glu.h>#include <gl/glut.h>#include <stdio.h>#include <stdlib.h>#include "game.h"#include "gui.h"#include "image.h"//codegame.h#ifndef _GAME_H_#define _GAME_H_#include "gui.h"#ifdef _DEBUG_CLIENT_   #include "error.h"   DebugIO* error = new DebugIO("error.txt");   bool glInit();   bool renderBG();#else   void glInit();   void renderBG();#endifvoid renderScreen();void FPS(int);void mouseDown(int,int,int,int);void mouseMove(int,int);void keyboardNormal(unsigned char,int,int);void keyboardSpecial(int,int,int);void glCleanUp();void windowResize(int,int);int fps = 0;GLint bgTexture;cGUI* client = new cGUI;#endifThe linker claims of redefinitions of every function in game.h... and I'm confuzzled. Gui.cpp needs game.h for glCleanUp. :/Any and all help is appreciated.-Etyrn   
  You're not doing the #ifndef trick, but I don't think its going to help you.#ifndef YOUR_DEF_HERE#define YOUR_DEF_HERE...code...#endifYou don't even have any ifndefs.And do not put variable definitions in a .h file. At least not non-class variables.**whatever.cpp**DebugIO* error = new DebugIO("error.txt");**whatever.h**extern DebugIO* error;This will make any file that includes whatever.h be able to use error.Edit: You already use externs, but you still declare some variables in the .h file.   ;  I don't? O_oThen what's with that #ifndef _GAME_H_ at the top of ehm... game.h?-EtyrnEdit: Fixed the class inits. :P   ;// game.hint fps = 0;GLint bgTexture;cGUI* client = new cGUI;You cannot have definitions in header files. Some time or other you will get nasty errors. You need to use the "extern" keyword in header files, and provide the definitions in exactly one source file:// game.cppint fps = 0;GLint bgTexture;cGUI* client = new cGUI;//game.hextern int fps;extern GLint bgTexture;extern cGUI* client;;  You have one #ifndef, but what about gui.h?Also, may I point out this article?Edit: wrong article, lemmee find the right one. Though that one might still be good to read.   ;  Alright! Working great now, and I learned a valuable lesson. :OThankens!-Etyrn   ;  Oh, and  here's the article I was looking for.   ;Quote:Original post by EzbezYou have one #ifndef, but what about gui.h?Also, may I point out this article?Edit: wrong article, lemmee find the right one. Though that one might still be good to read.I used to organise my headers with a single Global.h that included all my other includes. I found though that when working with a larget project this really caused problems, as any mistake in a header file would cause every single .cpp file to be recompiled whether it was needed or not =/For smaller projects using a single Global.h that all .cpp files include is definitely helpful. During development of a larger project it can be a nightmare =/;Quote:Original post by EzbezOh, and  here's the article I was looking for.lol, yeah thats definitely a better article. Hopefully my post before still makes some sense =)   ;  Oops, just noticed your post. Yes I do have the ifndefs in gui.h, but I didn't post that. I posted gui.cpp. :P-EtyrnEdit: And thanks for the article.   