Advertisement

Problem when compiling SFML game with Code::Blocks

Started by August 26, 2015 09:36 AM
12 comments, last by wintertime 9 years, 4 months ago

Whenever I try to compile my SFML game with Code::Blocks I get this weird error:


||=== Build: Debug in Test (compiler: GNU GCC Compiler) ===|
C:\Program Files\SFML-2.3.1\lib\libsfml-system-s-d.a(String.cpp.obj)||In function `ZNKSbIjSt11char_traitsIjESaIjEE8_M_checkEjPKc':|
C:\Dev\MinGW32-PosixDwarf492r2\i686-w64-mingw32\include\c++\bits\basic_string.h|324|undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===| 

Here is my linker settings:

pEMe6qS.png

I also have defined SFML_STATIC.

I really don't know why I'm getting that error, help please?

check here

http://en.sfml-dev.org/forums/index.php?topic=18187.0 smile.png

Advertisement

Ok, well, how can I update/upgrade my GCC compiler ?

qyrM1Q9.png

The "Mark for Upgrade" thing is not available. Any ideas ? :S

Ok, well, how can I update/upgrade my GCC compiler ?

qyrM1Q9.png

The "Mark for Upgrade" thing is not available. Any ideas ? :S

Download and install the 32-bit bundle of TDM-GCC.

I think I fixed that problem, I just had the wrong build options. But, on to the next problem...

afOk2yn.png

That's exactly the same problem, except you apparently changed from static linking to dynamic linking. All your changed build option did was to move the error from compile time to run time.

SFML is trying to call a function that is missing in your version of the standard library. The first step when you get linker errors about stuff being undefined is to copy paste the error (or at least the symbol it complains about) into a search engine (unless you already know which library or source file contains the missing code). All results are the same: you need at least GCC 4.9.

From the fact you HAVE SFML libraries and the error you see now, I would assume you didn't build SFML yourself and just grabbed some pre-built binaries. Those were built with a newer version of GCC and the simplified issue is: it's not compatible with yours (technically the problem is more with the different standard library versions).

Since you're on Windows anyway and struggling with very common compiler/linker errors: why are you adding the extra pain and complexity of using an IDE that uses MinGW instead of some Visual Studio Express or Community version? Dealing with the extra issues from potentially outdated GNU ports for Windows is not something I'd do without a very good reason.

f@dzhttp://festini.device-zero.de
Advertisement

That's exactly the same problem, except you apparently changed from static linking to dynamic linking. All your changed build option did was to move the error from compile time to run time.

SFML is trying to call a function that is missing in your version of the standard library. The first step when you get linker errors about stuff being undefined is to copy paste the error (or at least the symbol it complains about) into a search engine (unless you already know which library or source file contains the missing code). All results are the same: you need at least GCC 4.9.

From the fact you HAVE SFML libraries and the error you see now, I would assume you didn't build SFML yourself and just grabbed some pre-built binaries. Those were built with a newer version of GCC and the simplified issue is: it's not compatible with yours (technically the problem is more with the different standard library versions).

Since you're on Windows anyway and struggling with very common compiler/linker errors: why are you adding the extra pain and complexity of using an IDE that uses MinGW instead of some Visual Studio Express or Community version? Dealing with the extra issues from potentially outdated GNU ports for Windows is not something I'd do without a very good reason.

I don't think I changed to dynamic linking tho, as the SFML_STATIC was defined (?)

Edit: wait I did g++ --version and got this:

YNyGs78.png

I have 4.9.2 but the error is still happening :(

The problem is most likely: You downloaded the wrong/incompatible package from the SFML website.

Go back there and download the package compatible with your compiler or even better, learn to compile the library yourself (then its automatically compatible).

http://www.sfml-dev.org/faq.php#build-environment

The problem is most likely: You downloaded the wrong/incompatible package from the SFML website.

Go back there and download the package compatible with your compiler or even better, learn to compile the library yourself (then its automatically compatible).

http://www.sfml-dev.org/faq.php#build-environment

Huh, but I downloaded the GCC 4.9.2 MinGW(DW2) - 32-bit in the SFML download page.Maybe I can try to build/compile the library...

Your screenshot shows MinGW-W64 (thats the project name of the most up to date fork) and the download website says MinGW. You could ask in SFML forum, if you need to know which distribution they used exactly, but IIRC their preferred answer is "learn to compile yourself".

Btw., you might want to use the 64bit SEH version of MinGW-W64 if you have a 64bit OS, as DW2 got some problems on Windows if you throw through a callback compiled with a different compiler and SJLJ adds exception setup code to most functions.

This topic is closed to new replies.

Advertisement