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

Author Topic: windows linking errors against static SFML 2.0 Libraries  (Read 2607 times)

0 Members and 1 Guest are viewing this topic.

kattle87

  • Newbie
  • *
  • Posts: 6
    • View Profile
windows linking errors against static SFML 2.0 Libraries
« on: March 10, 2011, 09:30:24 pm »
Hi everyone.
I am trying using SFML libraries on windows, making some experiments with them.
I downloaded the SFML 2.0 snapshot and compiled it using cmake + mingw 4.5. The tick on BUILD_SHARED_LIBS on cmake was disabled, so in theory I built the static libraries correctly (after that I would just give the mingw32-make command).
I use Codelite for my project... it is really similar to Code::Blocks and it uses the same MinGW I used to compile the libraries.
Later on I copied the libs and added them to a path the linker checks for libraries, (let's say SFML2/lib), and when I try to compile my really simple test program (will upload code if required) I get the following errors:

Code: [Select]
C:/develop/minepp/minepp/sfmlServer/main.cpp:8: undefined reference to `_imp___ZN2sf9UdpSocketC1Ev'
C:/develop/minepp/minepp/sfmlServer/main.cpp:9: undefined reference to `_imp___ZN2sf9UdpSocket4BindEt'
C:/develop/minepp/minepp/sfmlServer/main.cpp:21: undefined reference to `_imp___ZN2sf9IpAddressC1EPKc'
C:/develop/minepp/minepp/sfmlServer/main.cpp:21: undefined reference to `_imp___ZN2sf9UdpSocket4SendEPKcjRKNS_9IpAddressEt'


A bunch of similar errors might follow as well.

The linker options are -lsfml-system-s -lsfml-network-s.
If I link against dynamic libs everything is fine (I compiled them with Cmake by enabling the checkbox for shared libs the day before), but I need 2 extra libs for the program to start: libstdc++-6.dll and libgcc_blablabla.dll.
I really have no idea about what's going on... Clearly the linker can't find something but I got no clue on what's missing.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
windows linking errors against static SFML 2.0 Libraries
« Reply #1 on: March 10, 2011, 10:18:36 pm »
You must define SFML_STATIC in your preprocessor options.
Laurent Gomila - SFML developer

kattle87

  • Newbie
  • *
  • Posts: 6
    • View Profile
windows linking errors against static SFML 2.0 Libraries
« Reply #2 on: March 11, 2011, 12:59:15 am »
aesh... Sorry for this being such a stupid problem!
I included SFML_STATIC in my preprocessor, but actually somehow failed in rebuilding the project. For this reason (and maybe something else I am missing here) I spent like 1 hour trying to understand what other mistakes I was doing... Well, I hope this will be useful for other people that just get the same strange errors...

Thank you very much!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
windows linking errors against static SFML 2.0 Libraries
« Reply #3 on: March 11, 2011, 07:55:52 am »
Quote
aesh... Sorry for this being such a stupid problem!

It's not, there's no tutorial for SFML 2 yet ;)
Laurent Gomila - SFML developer

 

anything