Here are the facts: I am using codeblocks on Ubuntu. I have installed SDL and SDL_ttf and have included and linked them successfully. I want to render text to the screen of the font, FreeSerif.
Here is the problem: When the program gets to the line, TTF_OpenFont("FreeSerif.ttf,20"), it returns NULL, which would then cause a segfault if passed to the TTF_RenderText_Solid function. I have added the font file to the project and it still did not work.
Here is the code:
TTF_Init();
TTF_Font *font = TTF_OpenFont("FreeSerif.ttf",20); //This returns NULL
if(!font){printf("Unable to open font");exit(1);} //The program exits here
TTF_GetError()
? It may say more about the opening error. – Laodicean