Hello all
I’m trying to get SDL_ttf lib working for my project but it seg fault when I try to initialize it.
I’m running on a 10.10 mac, everything compiles nicely but when I try to run the program it segfaults right at TTF_init().
Any help would be appreciated.
Thanks
Edit
Thought it might be good to include my initialization function.
bool init(){
bool success = true;
//Initialization of SDL if (SDL_Init(SDL_INIT_VIDEO) != 0){ std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl; success = false; }
//Create window else{
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1")) { success = false; printf("Warning linear filtering could not be enabled.\n"); }
window = SDL_CreateWindow("TKG Engine", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN); if (window == NULL){ success = false; printf("gRenderer could not be created. SDL_Error: %s", SDL_GetError()); } else{ gRenderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); if (gRenderer == NULL) { success = false; printf("gRenderer could not be created. SDL_Error: %s", SDL_GetError()); } else SDL_SetRenderDrawColor(gRenderer, 0xFF, 0xFF, 0xFF, 0xFF);
printf("Try to init TTF\n"); if( TTF_Init() == -1 ){ printf("When do you break."); success = false; printf( "SDL_ttf could not initialize! SDL_ttf Error: %s\n", TTF_GetError() ); }
}