Hey guys. New SDL user here. I'm working on a project, and I want to move the initializations to a separate CPP file than my game loop. It started out pretty good, I was able to move the SDL_Init function, the TTF_Init function, and the Surface creation to another cpp file, and declare them extern in the header. That worked fine. But when I move this function:
// In the header file:
extern TTF_Font* Font
// TTF_Font initialized globally in the 2nd CPP file:
TTF_Font* Font = TTF_OpenFont("/usr/share/fonts/truetype/freefont/FreeSans.ttf", 42);
// inside of a function inside the 2nd CPP file:
std::cerr << "TTF_OpenFont() Failed: " << TTF_GetError();
TTF_OpenFont failed is the error I get. I've been going nuts trying to figure out why. It works fine when that code is in main.cpp, so it's not permission or filepath issue.
Any ideas would be appreciated. Thanks.