Do not mix declaration with definition/instantiation in a .h file. Your are instantiating g_font
, g_window
and g_renderer
in isolation.h
file. The correct is instantiating only once, usually, in a .cpp
To solve your problem, change isolation.h
to declare those variables as external linkage:
//load global front
extern TTF_Font* g_font;
//window
extern SDL_Window* g_window;
//renderer
extern SDL_Renderer* g_renderer;
and instantiate them only once in an appropriate .cpp file, for example, init.cpp
2
solved Error multiple definition when compiling using headers [closed]