SFML community forums

Help => General => Topic started by: SquireNed on August 04, 2014, 02:03:26 am

Title: SFML issue Code::Blocks and static libraries
Post by: SquireNed on August 04, 2014, 02:03:26 am
So I'm getting the following compile-time error while trying to use a static library:

Quote
undefined reference to `_imp___ZN2sf6StringC1EPKcRKSt6locale'

This is matched by twenty or so companions, basically three or four for each line of code in the example main.cpp given in the tutorial (http://www.sfml-dev.org/tutorials/2.1/start-cb.php). There's a similar post around here on this forum that suggests it is a consequence of using the wrong version of SFML, but I've double checked and I'm using SJLJ and have my stuff pointed to SJLJ SFML.

Here's what I've double checked so far:


Long story short, I'd like to at least be able to use the static library functionality, but it doesn't seem happy when I try to do so.
Title: Re: SFML issue Code::Blocks and static libraries
Post by: fr33k on August 04, 2014, 09:14:00 am
You don't need this tutorial. If you don't have lastest realase of C::B, you should download it.
In Code::Blocks 13.12 you have updated SFML Project, you just need to select
New Project...->SFML Project->sfml 2.0 and give a path to sfml 2.1 main folder.
That's all.  :)
Title: Re: SFML issue Code::Blocks and static libraries
Post by: Jesper Juhl on August 04, 2014, 10:06:16 am
My guess would be that you link the libraries in the wrong order.
Title: Re: SFML issue Code::Blocks and static libraries
Post by: SquireNed on August 05, 2014, 01:38:58 am
I had the order as they should be, but I wasn't including sfml-main (as this configuration seems to), and whatnot. In either case, the SFML Project works (maybe the tutorial should be updated?), and stuff compiles fine with static libraries now. Thanks for the help!
Title: Re: SFML issue Code::Blocks and static libraries
Post by: ath88 on August 05, 2014, 02:19:18 am
I've had the exact same error when trying to switch from using the dynamic library to using the static library. Recompiling the entire project solved the problem. Perhaps that could've done the trick for you too.
Title: Re: SFML issue Code::Blocks and static libraries
Post by: BeautiCode on August 05, 2014, 07:03:55 am
Do u have the right sfml? The TJSJ one or whatever.