SFML community forums

Help => General => Topic started by: thaithanh.phong on August 15, 2007, 10:40:28 am

Title: Compilation error (static linking mode)
Post by: thaithanh.phong on August 15, 2007, 10:40:28 am
Building a project with dynamic linking mode is ok.

Building with static linking option, I encountered this:

Code: [Select]
C:\SFML-1.0\lib\mingw\static\libsfml-window-d.a(Window.o):Window.cpp:(.text+0x253):: undefined reference to `sfClock::sfClock()'
C:\SFML-1.0\lib\mingw\static\libsfml-window-d.a(Window.o):Window.cpp:(.text+0x4af):: undefined reference to `sfClock::sfClock()'
C:\SFML-1.0\lib\mingw\static\libsfml-window-d.a(Window.o):Window.cpp:(.text+0x70a):: undefined reference to `sfClock::sfClock()'
C:\SFML-1.0\lib\mingw\static\libsfml-window-d.a(Window.o):Window.cpp:(.text+0x994):: undefined reference to `sfClock::sfClock()'
C:\SFML-1.0\lib\mingw\static\libsfml-window-d.a(Window.o):Window.cpp:(.text+0xc15):: undefined reference to `sfClock::sfClock()'
C:\SFML-1.0\lib\mingw\static\libsfml-window-d.a(Window.o):Window.cpp:(.text+0x15fe):: undefined reference to `sfClock::GetElapsedTime() const'
C:\SFML-1.0\lib\mingw\static\libsfml-window-d.a(Window.o):Window.cpp:(.text+0x1614):: undefined reference to `sfClock::Reset()'
C:\SFML-1.0\lib\mingw\static\libsfml-window-d.a(Window.o):Window.cpp:(.text+0x1725):: undefined reference to `sfClock::Reset()'
C:\SFML-1.0\lib\mingw\static\libsfml-audio-d.a(SoundStream.o):SoundStream.cpp:(.text+0x143):: undefined reference to `sfThread::sfThread()'
C:\SFML-1.0\lib\mingw\static\libsfml-audio-d.a(SoundStream.o):SoundStream.cpp:(.text+0x1f2):: undefined reference to `sfThread::~sfThread()'
C:\SFML-1.0\lib\mingw\static\libsfml-audio-d.a(SoundStream.o):SoundStream.cpp:(.text+0x265):: undefined reference to `sfThread::sfThread()'
C:\SFML-1.0\lib\mingw\static\libsfml-audio-d.a(SoundStream.o):SoundStream.cpp:(.text+0x314):: undefined reference to `sfThread::~sfThread()'
C:\SFML-1.0\lib\mingw\static\libsfml-audio-d.a(SoundStream.o):SoundStream.cpp:(.text+0x401):: undefined reference to `sfThread::~sfThread()'
C:\SFML-1.0\lib\mingw\static\libsfml-audio-d.a(SoundStream.o):SoundStream.cpp:(.text+0x42b):: undefined reference to `sfThread::~sfThread()'
C:\SFML-1.0\lib\mingw\static\libsfml-audio-d.a(SoundStream.o):SoundStream.cpp:(.text+0x517):: undefined reference to `sfThread::~sfThread()'
C:\SFML-1.0\lib\mingw\static\libsfml-audio-d.a(SoundStream.o):SoundStream.cpp:(.text+0x541):: undefined reference to `sfThread::~sfThread()'
C:\SFML-1.0\lib\mingw\static\libsfml-audio-d.a(SoundStream.o):SoundStream.cpp:(.text+0x798):: undefined reference to `sfThread::Launch()'
C:\SFML-1.0\lib\mingw\static\libsfml-audio-d.a(SoundStream.o):SoundStream.cpp:(.text+0x7b2):: undefined reference to `sfThread::Wait()'
C:\SFML-1.0\lib\mingw\static\libsfml-audio-d.a(SoundStream.o):SoundStream.cpp:(.text+0xa3e):: undefined reference to `sfSleep(float)'



Anyone?
Title: Compilation error (static linking mode)
Post by: Laurent on August 15, 2007, 11:22:15 am
Did you also link to sfml-system-d ? sfml-window-d depends on it.
Title: Compilation error (static linking mode)
Post by: Alp on August 15, 2007, 11:50:24 am
And it appears that with mingw, you must link libs as follows :

Quote
-lsfml-window -lsfml-system
Title: Compilation error (static linking mode)
Post by: thaithanh.phong on August 15, 2007, 02:27:00 pm
Yes, I even put all:

Quote
-lsfml-system-d
-lsfml-graphics-d
-lsfml-window-d
-lsfml-audio-d


Any further clues?
Title: Compilation error (static linking mode)
Post by: Laurent on August 15, 2007, 02:30:07 pm
As Alp said, the order is important. sfml-window must be specified before sfml-system.
Title: Compilation error (static linking mode)
Post by: thaithanh.phong on August 15, 2007, 02:49:19 pm
Thanks, it works now:

Quote
-lsfml-audio-d
-lsfml-graphics-d
-lsfml-window-d
-lsfml-system-d