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

Author Topic: [Solved] Problems statically linking to sfml2 using CB  (Read 2571 times)

0 Members and 1 Guest are viewing this topic.

drcrow

  • Newbie
  • *
  • Posts: 3
    • View Profile
[Solved] Problems statically linking to sfml2 using CB
« on: May 30, 2010, 12:30:55 pm »
I really feel like an idiot posting here.
I usually don't have problems with linking.
However, now i have.

I built sfml using the bat-script.
Everything went fine with no errors.
I copied everything (including *-s.a files) to my codeblocks lib directory.
I played around with sfml for a while, dynamic linking works fine.
To reduce the dl-size of my project, i tried to statically link.

However, i get a lot of linking errors.
Here's the first error:
Code: [Select]
D:\Programmering\GiantSilverGiraffe\Framework\src\Game.cpp|24|undefined reference to `_imp___ZN2sf12RenderWindowC1Ev'|

currently i am linking to:
-lsfml-graphics-s-d
-lsfml-window-s-d
-lsfml-system-s-d

What am i doing wrong?

EDIT: I removed SFML_DYNAMIC from my defines and static debug linking worked!

However, I still get linking problems when i try to build the release version.
.\obj\Release\MainMenu.o:MainMenu.cpp:(.text$_ZN11AltExitGameD1Ev[AltExitGame::~AltExitGame()]+0x39)||undefined reference to `_imp___ZTVN2sf4TextE'|

EDIT2: Okay, I've narrowed it down to being codeblocks fault.
In my codeblocks project, i have two targets, debug and release.
The two setups are nearly identical, yet linking fails with the release build.

I tried linking to the -s (not -s-d) on the debug target, and it built.
This seems like a really weird codeblocks related issue.

EDIT3: After duplicating the debug release, and modifying it, i finally have a realease build that works.
It's a mystery why it failed initially, though.

 

anything