Original Post
Hello. I am having trouble with using SFont. I get linker errors. Here I will show you my code and the errors.
#include <windows.h>
#include "stdlib.h"
#include "SDL/SDL.h"
#include <ctime>
#include "SFont.h"
#include "SDL_image.h"
// sdl variables
SDL_Surface *screen; // Pointer to backbuffer
SFont_Font* Font;
int main(int argc, char *argv[]) {
SDL_Init(SDL_INIT_VIDEO);
atexit(SDL_Quit);
screen = SDL_SetVideoMode(640, 480, 16, SDL_DOUBLEBUF);// | SDL_FULLSCREEN);
Font = SFont_InitFont(IMG_Load("24P_Copperplate_Blue.png"));
if(!Font) {
fprintf(stderr, "An error occured while loading the font.");
exit(1);
}
while(!post_quit) {
get_k_input();
if(!render_screen())
return 0;
}
SFont_FreeFont(Font);
// Exit with success
return 1;
}
bool render_screen(void) {
// Clear the screen
SDL_FillRect(screen,0,0);
// Font
SFont_Write(screen, Font, 0,0,"Welcome to SFontTest1!");
SDL_Flip(screen);
return 1;
}
(I took irrelivent stuff out). Here are the errors. [Linker error] undefined reference to IMG_Load' [Linker error] undefined reference to SFont_InitFont' [Linker error] undefined reference to SFont_FreeFont' [Linker error] undefined reference to SFont_Write' Any suggestions? Thanks!