I have a big project where I just moved from SFML 1.6 to 2.0. Dynamic linking worked fine until now. After changing to static linking I get this error:
src/input.o:input.cpp:(.text+0x1c): undefined reference to `_imp___ZN2sf6Window5closeEv'
src/input.o:input.cpp:(.text+0x1f3): undefined reference to `_imp___ZN2sf5Mouse11setPositionERKNS_7Vector2IiEERKNS_6WindowE'
src/input.o:input.cpp:(.text+0x21c): undefined reference to `_imp___ZN2sf8Keyboard12isKeyPressedENS0_3KeyE'
src/input_mode.o:input_mode.cpp:(.text+0x6c): undefined reference to `_imp___ZN2sf8Keyboard12isKeyPressedENS0_3KeyE'
src/application_context.o:application_context.cpp:(.text+0xaa): undefined reference to `_imp___ZN2sf9VideoMode18getFullscreenModesEv'
src/application_context.o:application_context.cpp:(.text+0xdd): undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'
src/application_context.o:application_context.cpp:(.text+0x11f): undefined reference to `_imp___ZN2sf6StringC1EPKcRKSt6locale'
src/application_context.o:application_context.cpp:(.text+0x158): undefined reference to `_imp___ZN2sf12RenderWindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE'
Compiling is fine and I cleaned the project many times. I compiled the
SFML 2.0 libraries by myself, with CMake and MinGW-GCC. The dynamic libraries worked fine. I have set
BUILD_SHARED_LIBS = FALSE for compiling the static libs.
The result were this lib files (I only need this 3) which I added to the "lib" directory to my project:
- libsfml-window-s.a
- libsfml-system-s.a
- libsfml-graphics-s.a
I used the following command to link with
MinGW-GCC 4.7.2:
g++
-DSFML_STATIC -Iinc -std=gnu++0x -O3 -fmessage-length=0 -DNDEBUG -o bin/SFML-Prototype-Release.exe
(object files) -Llib -Lbin -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lFreeImage -lglew32 -lglu32 -lopengl32
And having files in "
bin" directory:
And files in "
lib" directory:
- libsfml-window-s.a
- libsfml-system-s.a
- libsfml-graphics-s.a
- FreeImage.lib
Hard- & Software:I am using Windows 7 Prof. 64bit on a 5 year old notebook hardware:
Intel 2 Duo P8600 - 2.4Ghz
Nvidia Geforce 9600M GT
4GB RAM