   Working with includes
  Hello there. Im doing my first little game and im having a little issue. I was making it in C++ / Code::Blocks.  I started out with the map editor, using 3 file:  Main.cpp -> the map editor itself  maps.h -> have all the map functions like drawing  resources.h -> load music n stuffNow, i just created another file called battle.cpp, witch will load a map saved by main.cpp, but im having the includes issue. I cannot include my 2 headers on my battle.cpp cause the compiler says the functions on those headers are already declared. If i dont include it, they say the function doesnt exists. What should i do ?   
  Read this.   ;  Ive tryed doing things as the tutorial sayd, ive come with my sources like this:http://rapidshare.com/files/390491317/Iso.rar.htmlbut it aint working. i declare variables at headers as extern, then make the correspondent .cpp with functions (already declared at header) but when the compiler read those functions it says that the variables were not declared.Batalha.cpp and mapedit.cpp should be 2 different executables, i tell the compiler that by making them with int Main() right ?ty[]´s   ;  not only do they need to both have a main function they need to be in different projects in code blocks. code blocks assumes every file in a project is a part of one lib\executable.   ;  ohh, so i would need to make 2 projects to make this work then put all headers and .cpps files on those projects ?  And, how would i do that if i cannot read the extern variables im getting ?   ;Quote:Original post by MadHippiebut it aint working. i declare variables at headers as extern, then make the correspondent .cpp with functions (already declared at header) but when the compiler read those functions it says that the variables were not declared.It gives that error because the variables were not declared, only extern'ed. Read Fixing problem 4 in the article again, specifically:Quote:Of course, these are just declarations that my_global and SomeFunction exist somewhere. It doesn't actually create them. You still have to do this in one of the source files, as otherwise you will see a new linker error when it finds it cannot resolve one of the identifiers to an actual address. So for this example, you would add "int my_global" to either Code1.cpp or Code2.cpp, and everything should work fine. If it was a function, you'd add the function including its body (ie. the code of the function) into one of the source files. ;  Or you can move the data and functions out of the header, write decent access routines and avoid the whole problem.   ;  Fixed. Thanx alot for the replyes =]   