User forums > Help
How can I use SDL_ttf with code blocks?
Zamp:
I've been learning SDL recently by using Lazy Foo's tutorials, and I can't get get SDL_ttf to work. I'm using the Sept 10 build of Code Blocks for openSUSE 10.2.
I went to the SDL website, and downloaded the development rpm file, and when I did that it got installed with openSUSEs Install Software program, and it said it installed successfully, so I thought everything was fine. Then I tried to use it in my current program I'm making, and it doesn't work. In the Build Options then linker settings, I added 'SDL_ttf' ( no quotes), and added #include <SDL_ttf.h> to the top and it doesn't work. When I installed SDL_image, all I did was install the rpm and add 'SDL_image' to the linker options, and #include <SDL_image.h>, and that works fine. So how exactly do I get it to work? I even copy and pasted Lazy Foo's whole program and tried to compile it, but it didn't work either.
When I try to compile it, I get this error:
--- Code: ---:: === Pong, Debug ===
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `TTF_Quit':
(.text+0x269):: undefined reference to `FT_Done_FreeType'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `Find_Glyph':
(.text+0x3af):: undefined reference to `FT_Load_Glyph'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `Find_Glyph':
(.text+0x4ed):: undefined reference to `FT_Render_Glyph'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `Find_Glyph':
(.text+0x727):: undefined reference to `FT_Get_Char_Index'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `Find_Glyph':
(.text+0x745):: undefined reference to `FT_Render_Glyph'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `Find_Glyph':
(.text+0x7a1):: undefined reference to `FT_Outline_Transform'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `TTF_SizeUNICODE':
(.text+0x1252):: undefined reference to `FT_Get_Kerning'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `TTF_RenderUNICODE_Blended':
(.text+0x15f5):: undefined reference to `FT_Get_Kerning'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `TTF_RenderUNICODE_Shaded':
(.text+0x19d1):: undefined reference to `FT_Get_Kerning'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `TTF_RenderUNICODE_Solid':
(.text+0x2077):: undefined reference to `FT_Get_Kerning'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `TTF_CloseFont':
(.text+0x21bf):: undefined reference to `FT_Done_Face'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `TTF_OpenFontIndexRW':
(.text+0x2349):: undefined reference to `FT_Open_Face'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `TTF_OpenFontIndexRW':
(.text+0x2399):: undefined reference to `FT_Set_Pixel_Sizes'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `TTF_OpenFontIndexRW':
(.text+0x2457):: undefined reference to `FT_Set_Char_Size'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `TTF_OpenFontIndexRW':
(.text+0x2475):: undefined reference to `FT_MulFix'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `TTF_OpenFontIndexRW':
(.text+0x2491):: undefined reference to `FT_MulFix'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `TTF_OpenFontIndexRW':
(.text+0x24b8):: undefined reference to `FT_MulFix'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `TTF_OpenFontIndexRW':
(.text+0x24d4):: undefined reference to `FT_MulFix'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `TTF_OpenFontIndexRW':
(.text+0x24ed):: undefined reference to `FT_MulFix'
/usr/lib/libSDL_ttf.a(SDL_ttf.o):: In function `TTF_Init':
(.text+0x2698):: undefined reference to `FT_Init_FreeType'
:: === Build finished: 20 errors, 0 warnings ===
--- End code ---
Auria:
Seems like you need to install FreeType and link against it
Zamp:
Ah alright thanks. That seemed to fix it =D
Zamp:
I have another question. Like I said before, I'm using the Sept 10 CodeBlocks build for openSUSE 10.2. How can I compile a project so there is an executable that I can run the game from? Right now the only way I know how to run it is open up C::B and click the build and run button, but lets say I made a cool program I wanted to share with my friends and they didn't have Code::Blocks, how could I make an executable or some kind a file that will run the game without needing Code::Blocks installed?
In the folder where the project is saved, theres a folder called bin and inside that are two more folders called Debug and Release. In both of those folders is a file called Pong and it says it is executable, but when I try to run it, it opens up real quick and closes. So yeah...
>__> Hopefully that made sense. Basically, how can I run the program without having to open up Code::Blocks first?
Auria:
The executable you're mentionning is what you want. Try running it from the terminal to see what's going wrong.
They will also need to install required dependencies, of course. You may want to read about making debs/rpms/autopackages/etc. for more info on distribtuing stuff on linux (i don't know what suse uses)
Navigation
[0] Message Index
[#] Next page
Go to full version