Hello! I'm making a program with lots of headers, but it doesn't link correctly, displaying the "not declared in this scope" error. How should i #include those headers correctly?
The problem is that it says window and teksturos is not declared in this scope.
They're not.
tile.cpp includes tile.h
tile.h includes SFML/Graphics.hpp and defines the tile class.
tile.cpp does not include ANYTHING that defines or includes 'window' or 'teksturos'. For that, it would need to include 'sfml_data' since that is where they are defined.
However... that will open up other problems because then you'd be defining those objects in multiple cpp files. So you'll get a linker error saying the objects are defined multiple times.
My advice: find a way to do this without using global variables.
But i need to have those variables global, because they need to be loaded to memory only once, otherwise, loading them to memory from a file each time a tile is generated, it would slow down a performance very much!
Maybe i should try to make some class and load those sfml-data variables there?