Upon attempting to compile my code I get the following error:
"The application was unable to start correctly (0x000007b). Click ok to close
the application."
I know the problem is most likely associated with my SDL2_ttf library. I have no problem linking the library, however, The following code when commented
rids of the issue:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
SDL_Texture* CSprite::RenderText(std::string message, std::string fontFile, SDL_Color color, int fontSize)
{
//Open the font
TTF_Font *font = nullptr;
//font = TTF_OpenFont(fontFile.c_str(), fontSize);
//if (font == nullptr)
//throw std::runtime_error("Failed to load font: " + fontFile + TTF_GetError());
//Render the message to an SDL_Surface, as that's what TTF_RenderText_X returns
SDL_Surface *surf = TTF_RenderText_Blended(font, message.c_str(), color);
SDL_Texture *texture = SDL_CreateTextureFromSurface(surface, surf);
//Clean up unneeded stuff
//SDL_FreeSurface(surf);
//TTF_CloseFont(font);
return texture;
}
|
I didn't have problems at all relating this until I linked the SDL2_ttf library to my project and tried running this function. Currently how it is shown above will result in the previously described error. I have already tried the following solutions from other websites online:
rebooting computer.
reinstalling Net.dll (I believe is what its called)
re-linking the libraries
reinstalling Visual Studios 2013 (which is the compiler I am currently using
by the way, on windows 7)
Pasting all code into a different project that was linked correctly
Any help or insight would be much appreciated. Thanks so much