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

Author Topic: Compilation error (static linking mode)  (Read 9528 times)

0 Members and 1 Guest are viewing this topic.

thaithanh.phong

  • Newbie
  • *
  • Posts: 4
    • View Profile
Compilation error (static linking mode)
« 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Compilation error (static linking mode)
« Reply #1 on: August 15, 2007, 11:22:15 am »
Did you also link to sfml-system-d ? sfml-window-d depends on it.
Laurent Gomila - SFML developer

Alp

  • Jr. Member
  • **
  • Posts: 56
    • MSN Messenger - alpmestan@hotmail.com
    • View Profile
    • http://alp.developpez.com/
    • Email
Compilation error (static linking mode)
« Reply #2 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
SFML developper

thaithanh.phong

  • Newbie
  • *
  • Posts: 4
    • View Profile
Compilation error (static linking mode)
« Reply #3 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Compilation error (static linking mode)
« Reply #4 on: August 15, 2007, 02:30:07 pm »
As Alp said, the order is important. sfml-window must be specified before sfml-system.
Laurent Gomila - SFML developer

thaithanh.phong

  • Newbie
  • *
  • Posts: 4
    • View Profile
Compilation error (static linking mode)
« Reply #5 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