Thread: Setting Up SDL TTF

  1. #1
    Registered User
    Join Date
    Aug 2013
    Posts
    40

    Setting Up SDL TTF

    Hey,

    I'm trying to compile a SDL TTF program for the first time with GCC but I can't get the flags right. I'm using:

    gcc -std=c99 -Wall game.c -I/usr/include/SDL2 -I/usr/include/SDL/ -lSDL2 -o game


    I have TFF2.0 installed in the default Linux location. The only TTF function I have used is TTF_Init(). I keep getting this error "
    undefined reference to `TTF_Init'"

    I have included <SDL_ttf.h>.

  2. #2
    Registered User
    Join Date
    Aug 2013
    Posts
    40
    I have it working now... Please delete thread

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Or you could post your solution, so others who come across this thread might get the answer they need.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Aug 2013
    Posts
    40
    Sure thing...

    I found the solution here SDL_ttf 2.0.10: Compiling. I was missing the -lSDL_ttf flag in my gcc command.

    So the full command now is: gcc -std=c99 -Wall game.c -I/usr/include/SDL2 -I/usr/include/SDL/ -lSDL2 -lSDL_ttf -o game

  5. #5
    Registered User
    Join Date
    Nov 2012
    Posts
    1,393
    Quote Originally Posted by Xecutive View Post
    So the full command now is: gcc -std=c99 -Wall game.c -I/usr/include/SDL2 -I/usr/include/SDL/ -lSDL2 -lSDL_ttf -o game
    Why do you have both SDL2 and SDL in your include path? The last I checked, SDL versions 1 and 2 are not compatible, so it may not be a good idea to have the version 1 headers in your search path.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Setting Up SDL
    By Xecutive in forum C Programming
    Replies: 22
    Last Post: 11-27-2016, 04:33 PM
  2. Setting up SDL for C
    By 7h3_0r4c1_3 in forum C Programming
    Replies: 1
    Last Post: 08-25-2010, 10:30 AM
  3. Bit setting
    By c_lady in forum C Programming
    Replies: 2
    Last Post: 03-09-2010, 01:11 PM
  4. Setting up Dev C++
    By Suchy in forum Tech Board
    Replies: 11
    Last Post: 11-11-2006, 02:38 PM
  5. Bit setting
    By fizz_uk83 in forum C Programming
    Replies: 2
    Last Post: 09-22-2003, 02:14 AM

Tags for this Thread