Getting SFML to work with Code::Blocks

Hello every one. Like the title says I am trying to get SFML 1.6 to work with Code::Blocks. I have followed the tutorials on the SFML website but when ever I try to run the sample program it provides I receive these errors in the build log.

C:\sfml1.6\SFML-1.6\lib/libsfml-system-s.a(Clock.o):Clock.cpp:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
C:\sfml1.6\SFML-1.6\lib/libsfml-system-s.a(Platform.o):Platform.cpp:(.text+0xca): undefined reference to `_Unwind_Resume'
C:\sfml1.6\SFML-1.6\lib/libsfml-system-s.a(Platform.o):Platform.cpp:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0' 

If anyone can point me in the right direction as far as whats wrong that would be great. Also I have had a heck of a time getting SFML to link, this is the first time I have tried to use a library so I was wondering if it is usually difficult or is just a first time doing but it will get easier type of thing?
It looks like you're compiling with gcc rather than g++ if it can't find _gxx_personality_v0. What are your compiler settings in Code::Blocks?
In compiler and debugger settings, under the "Select Compiler" drop down menu I do have "GNU GCC compiler" selected. I looked under the drop down menu and did not find one that has g++ in it. Do I have to download it it? Also under compiler flags I have "Have g++ follow the coming C++0x ISO C++ language standard [-std=c++0x]" selected. If that helps.
Well then it sounds like you have everything right, I don't see why its telling you that it doesn't understand g++ unless your minGW install is broken :/

Although on a side note you might want to follow c++11x as that comes with some pretty nice features for c++.
Make sure the settings here are correct:
@drew. Yeah it is really confusing me. Actually I do not have the c++11x option, does that mean my compiler is out of date? If so could that be causing the problem?

@cire. I checked my settings to the photo you linked and the only difference is my make program which is make.exe and the debugger which is gdb.exe.
Well I don't know if thats the cause of the problem, but if your version of code::blocks doesn't reconize c++11 then it is definitely out of date.
Can you tell us what exactly you did while setting up ?
Try this:
Copy the sfml header folder into your g++'s header folder and when you try to make an sfml project go to compiler settings,under linking tab select the sfml .lib files
Are you using a precompiled SFML distribution?

It may be that you need to re-compile SFML. If the library version isn't compatible with the runtime library for the compiler, it could cause that issue.

[Edit: By the way, if you're just starting with SFML, it would make more sense at this point in SFML's development to begin with 2.0 than 1.6]
Last edited on
Well i downloaded SFML 1.6 and put it in a file on my C: drive. I then went to settings> Global compiler settings > search directories tab > under compiler I put the path to the SFML "include" folder. Under linker I put the path to the "lib" folder. In linker settings > link libraries i put the paths to libsfml-graphics.a, libsfml-window.a, libsfml-system.a in that order. In other linker options I also put -lsfml-graphics-s, -lsfml-window-s, -lsfml-system-s.
Also I repeated this in, project > build options. I also put "SFML_STATIC" under the #defines tab. Everything in the debugger link libraries has the "-d" tag at the end.

@ cire. I just downloaded the files straight from the SFML website. To be honest I am not sure how to recompile it. Also I did originally start with 2.0 but when I tried to run it I got over 50 errors, it seemed like it wasn't recognizing the library at all. When I tried 1.6 I only got a couple of errors so I figured I was closer to getting it to work. lol
@drew. Yeah it is really confusing me. Actually I do not have the c++11x option, does that mean my compiler is out of date? If so could that be causing the problem?

You probably have CB 12.05. That option was added in 12.11, which comes with gcc 4.7. In the old version (with gcc 4.6.3) it's called -std=c++0x. But that's definetly not the problem.
The release candidate for 2.0 and the version of 1.6 which is available precompiled (which isn't supported any more) are both incompatible with up-to-date compilers (it would be nice if there was a prominent note where they can be downloaded.) There is a thread with unofficial builds on the SFML forums which you can use if you aren't up to compiling SFML for yourself yet.

You can find that here:

Just make sure you match up compiler versions.

[edit: Unfortunately I don't think there are any builds available for Linux, so if you're using Linux you'd need to compile it yourself.]
Last edited on
I was able to solve the problem, Cire was right about the compiling. I was able to find a tutorial on youtube that showed me how to do it. It actually wasn't that hard once I got into it. Thank you every one for the help.
Topic archived. No new replies allowed.