error with SDL_ttf

closed account (96AX92yv)
im new to SDL and im trying to add text to my game but when i add the ttf code it comes up with an error:

1>main.obj : error LNK2019: unresolved external symbol _TTF_OpenFont referenced in function _SDL_main

anyone know how to fix it?


the error is with this code:
font = TTF_OpenFont( "lazy.ttf", 36 );
Last edited on
The problem is not with your code. The problem is that you don't link the SDL_ttf library.
closed account (96AX92yv)
thanks i missed out a tiny bit on adding the ttf
Last edited on
closed account (96AX92yv)
ive been tring for a while now but the text that i enter is not visible. i have been following the lazy foo' tuts but i cant see a change.

#include "SDL.h"
#include "SDL_ttf.h"
#include "SDL_image.h"

SDL_Surface *text
TTF_Font *font = NULL;
SDL_Color textColor = { 255, 255, 255 };

//in main()
font = TTF_OpenFont( "lazy.ttf", 36 );

//in main while loop
apply_surface(10,10, text, screen);

//rend_text function
void rend_text (char message)
text = TTF_RenderText_Solid( font, &message, textColor );

//apply_surface function
void apply_surface (int x, int y,
SDL_Surface* source, SDL_Surface* destination)
SDL_Rect rect;
rect.x = x;
rect.y = y;

SDL_BlitSurface (source, NULL, destination, &rect);

im not sure how clear this is so ask if i need to explain it.

Last edited on
Topic archived. No new replies allowed.