To start with, a lot of my code was in one cpp file, but I am now cleaning
up a lot of my code, and have run into a problem.
First of all I have my main function in main.cpp where I initialise my
I define the surface in globals.h, where I keep all my global and const
variables that are used through the whole program. I also have the main
header files such as SDL.h included in this file. Now the part I am
developing at the moment is the editor function, which is located in
editor.cpp, and I blit the interface to the mainscreen surface
main.cpp has globals.h included in it
editor.cpp has editor.h included in it
editor.h has globals.h included in it
globals.h has editor.h included in it.
When I try to compile, I get an error:
editor.cpp C:\Dev-Cpp\Tane\Galactic\editor.o(.bss+0x0) multiple definition
main.cpp C:\Dev-Cpp\Tane\Galactic\main.o(.bss+0x0) first defined here
It does the same with every other const I have, but since they are all not
essetial at the moment, I have commented them out.
I am compiling in Dev-C++, and all header files have #ifndef at the top so
they should not be included twice. Where am I going wrong? editor.h needs
to have globals.h included so it knows some global variables, and globals.h
needs to have editor.h included so it knows the editor functions (main.ccp
only has globals.h included). I might be something simple I am looking
over, but can anyone help?
Sorry if it’s confusing too