Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML issue Code::Blocks and static libraries  (Read 2045 times)

0 Members and 1 Guest are viewing this topic.

SquireNed

  • Newbie
  • *
  • Posts: 2
    • View Profile
SFML issue Code::Blocks and static libraries
« 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:

  • I am linking to libsfml-xxx-s-d for my debug setup and libsfml-xxx-s for my release setup, and they go in graphics->window->system order as shown in the tutorial.
  • I have SFML_STATIC set in my #defines.
  • The program works if I have my setup use the SJLJ DLL's

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.
« Last Edit: August 04, 2014, 02:07:03 am by SquireNed »

fr33k

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: SFML issue Code::Blocks and static libraries
« Reply #1 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.  :)

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: SFML issue Code::Blocks and static libraries
« Reply #2 on: August 04, 2014, 10:06:16 am »
My guess would be that you link the libraries in the wrong order.

SquireNed

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: SFML issue Code::Blocks and static libraries
« Reply #3 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!

ath88

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: SFML issue Code::Blocks and static libraries
« Reply #4 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.

BeautiCode

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: SFML issue Code::Blocks and static libraries
« Reply #5 on: August 05, 2014, 07:03:55 am »
Do u have the right sfml? The TJSJ one or whatever.

 

anything