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

Author Topic: [Solved] How to statically link sfml-audio with Qt 4.7.4 (MinGW 4.4)?  (Read 8187 times)

0 Members and 1 Guest are viewing this topic.

ccleung6

  • Newbie
  • *
  • Posts: 22
    • View Profile
Hi all,

I have made a test project to play sound with Qt.

I use SFML 2.0 Windows 32 bits - GCC SJLJ (Code::Blocks)

the Qt project:
#################################
QT       += core gui
#QT  += phonon
CONFIG += debug

TARGET = TestLoadSound
TEMPLATE = app

#DEFINES += SFML_STATIC

LIBS += -lsfml-audio
LIBS += -L"D:/SFML-2.0-rc/lib"

INCLUDEPATH += "D:/SFML-2.0-rc/include"


SOURCES += main.cpp\
        window.cpp

HEADERS  += window.h
################################
 
window.h
###################################
#ifndef WINDOW_H
#define WINDOW_H

#include <QtGui/QWidget>
//#include <Phonon/AudioOutput>
//#include <Phonon/MediaObject>
#include <SFML/Audio.hpp>

class Window : public QWidget
{
    Q_OBJECT
   
public:
    Window(QWidget *parent = 0);
    ~Window();

public slots:
    void LoadAndPlaySound();

private:
    //Phonon::MediaObject *player;
    //Phonon::MediaObject *player2;
    //Phonon::AudioOutput *audioOutput;
    sf::SoundBuffer buffer;
    sf::Sound sound;
    std::string path;
};

#endif // WINDOW_H
##############################

window.cpp
###################################

#include "window.h"
#include <QtGui>
//#include <phonon>

Window::Window(QWidget *parent)
    : QWidget(parent)
{
    QVBoxLayout *layout = new QVBoxLayout(this);
    QPushButton *btn = new QPushButton(tr("Play Sound"));

    connect(btn,SIGNAL(clicked()),this,SLOT(LoadAndPlaySound()));

    layout->addWidget(btn);

    setLayout(layout);
    /*
    player = new Phonon::MediaObject(this);
    player2 = new Phonon::MediaObject(this);
    audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory,this);
    Phonon::createPath(player,audioOutput);
    Phonon::createPath(player2,audioOutput);
    */

    //buffer = new sf::SoundBuffer();
    //sound = new sf::Sound();

    QString file = QApplication::applicationDirPath() + QDir::separator() + "117-Fire01.wav";
    path = file.toStdString();

}

Window::~Window()
{

}

void Window::LoadAndPlaySound()
{
    /*
    //QString file = QCoreApplication::applicationDirPath() + "/117-Fire01.wav";
    QString file = QCoreApplication::applicationDirPath() + "/117-Fire01.wav";
    QString file2 = QCoreApplication::applicationDirPath() + "/120-Ice01.wav";
    //QString file = QCoreApplication::applicationDirPath() + "/hello goodbye & hello - anri kumaki.mp3";
    if(QFile::exists(file)){
        //qDebug() << file + " exists.";
        //Phonon::MediaSource source(file);
        player->setCurrentSource(file);
        //Phonon::createPath(player,audioOutput);
        player->play();

        player2->setCurrentSource(file2);
        player2->play();
    }else{
        qDebug() << file +  " does not exist.";
    }
    //QSound::play("117-Fire01.wav");
    //Phonon::MediaObject *music = Phonon::createPlayer(Phonon::MusicCategory,Phonon::MediaSource("Fire.ogg"));
    //music->play();
    */



    bool ok = buffer.loadFromFile(path);
    if(ok)
    {
        sound.setBuffer(buffer);
        sound.play();
    }else
    {
        qDebug() << "Failed";
    }

}
########################################

main.cpp
########################################

#include <QtGui/QApplication>
#include "window.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Window w;
    w.show();
   
    return a.exec();
}
#######################################

the program can run and play the sound, but when close the program, it crashed.

Searched forum, it is a known issue of openal dynamic lib?

Could this problem solved by static linking sfml-audio ?

but how to static link?

I tried add 
defines += SFML_STATIC

and
LIBS += -lsfml-audio-s

but fail to complie...

Could any one help?

Thanks
« Last Edit: August 25, 2012, 03:18:23 pm by ccleung6 »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: How to statically link sfml-audio with Qt 4.7.4 (MinGW 4.4)?
« Reply #1 on: August 21, 2012, 08:49:37 pm »
Quote
the program can run and play the sound, but when close the program, it crashed.
Then use the debugger to get more details about the crash. That's what debuggers are made for :)

Quote
I tried add 
defines += SFML_STATIC

and
LIBS += -lsfml-audio-s

but fail to complie...
What was the error?
Laurent Gomila - SFML developer

ccleung6

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: How to statically link sfml-audio with Qt 4.7.4 (MinGW 4.4)?
« Reply #2 on: August 22, 2012, 01:19:25 pm »
Hi Laurent,

It gives tons of error:

19:09:53: Running build steps for project TestLoadSound...
19:09:53: Configuration unchanged, skipping qmake step.
19:09:53: Starting: "D:\QtSDK\mingw\bin\mingw32-make.exe"
D:/QtSDK/mingw/bin/mingw32-make.exe -f Makefile.Debug
mingw32-make.exe[1]: Entering directory `D:/Projects/TestLoadSound-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DSFML_STATIC -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtGui" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include" -I"..\..\SFML-2.0-rc\include" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\ActiveQt" -I"debug" -I"..\TestLoadSound" -I"." -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\win32-g++" -o debug\main.o ..\TestLoadSound\main.cpp
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DSFML_STATIC -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtGui" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include" -I"..\..\SFML-2.0-rc\include" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\ActiveQt" -I"debug" -I"..\TestLoadSound" -I"." -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\win32-g++" -o debug\window.o ..\TestLoadSound\window.cpp
D:\QtSDK\Desktop\Qt\4.7.4\mingw\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DSFML_STATIC -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtGui" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include" -I"..\..\SFML-2.0-rc\include" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\ActiveQt" -I"debug" -I"..\TestLoadSound" -I"." -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\win32-g++" -D__GNUC__ -DWIN32 ..\TestLoadSound\window.h -o debug\moc_window.cpp
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DSFML_STATIC -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtGui" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include" -I"..\..\SFML-2.0-rc\include" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\ActiveQt" -I"debug" -I"..\TestLoadSound" -I"." -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\win32-g++" -o debug\moc_window.o debug\moc_window.cpp
g++ -mthreads -Wl,-subsystem,windows -o debug\TestLoadSound.exe debug/main.o debug/window.o debug/moc_window.o  -L"d:\QtSDK\Desktop\Qt\4.7.4\mingw\lib" -lmingw32 -lqtmaind -lsfml-audio-s -LD:/SFML-2.0-rc/lib -lQtGuid4 -lQtCored4 -LC:\OpenSSL-Win32_full\lib
mingw32-make.exe[1]: Leaving directory `D:/Projects/TestLoadSound-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0xc4): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0xe6): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x1ab): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x1e3): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x1f1): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x213): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x245): undefined reference to `sf::Time::Time()'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x294): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x2de): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x515): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x537): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x569): undefined reference to `sf::Time::Time()'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x5b8): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x602): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x611): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x633): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x6cb): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x715): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x725): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x747): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x7df): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x829): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x8ae): undefined reference to `sf::milliseconds(int)'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x8c5): undefined reference to `sf::err()'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0xa1c): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0xa3e): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0xa9f): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0xad7): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0xae8): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0xb0a): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0xb72): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0xbab): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0xbbc): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0xbde): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0xc3f): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0xc77): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0xca7): undefined reference to `sf::err()'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0xe79): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0xe9b): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0xfe7): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x102c): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x1065): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x118d): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x11af): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x12fb): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x1340): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text+0x1379): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text$_ZNSt3setIPN2sf5SoundESt4lessIS2_ESaIS2_EED1Ev[std::set<sf::Sound*, std::less<sf::Sound*>, std::allocator<sf::Sound*> >::~set()]+0x9): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text$_ZNSt3setIPN2sf5SoundESt4lessIS2_ESaIS2_EED1Ev[std::set<sf::Sound*, std::less<sf::Sound*>, std::allocator<sf::Sound*> >::~set()]+0x2b): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text$_ZNSt3setIPN2sf5SoundESt4lessIS2_ESaIS2_EED1Ev[std::set<sf::Sound*, std::less<sf::Sound*>, std::allocator<sf::Sound*> >::~set()]+0x4f): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundBuffer.cpp.obj):SoundBuffer.cpp:(.text$_ZNSt3setIPN2sf5SoundESt4lessIS2_ESaIS2_EED1Ev[std::set<sf::Sound*, std::less<sf::Sound*>, std::allocator<sf::Sound*> >::~set()]+0x66): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0xa6): undefined reference to `sf::seconds(float)'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0xf5): undefined reference to `sf::Time::asSeconds() const'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x20d): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x22f): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x27e): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x2ad): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x2bd): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x2df): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x32e): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x35d): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x36d): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x38f): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x3e9): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x418): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x475): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x497): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x4f6): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x525): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x535): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x557): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x5b6): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x5e5): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x5f5): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x617): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x6d7): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x706): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x715): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x737): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x7f7): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(Sound.cpp.obj):Sound.cpp:(.text+0x826): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundFile.cpp.obj):SoundFile.cpp:(.text+0x2d3): undefined reference to `sf::Time::asSeconds() const'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundFile.cpp.obj):SoundFile.cpp:(.text+0x493): undefined reference to `sf::err()'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundFile.cpp.obj):SoundFile.cpp:(.text+0x537): undefined reference to `sf::err()'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundFile.cpp.obj):SoundFile.cpp:(.text+0x617): undefined reference to `sf::err()'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundFile.cpp.obj):SoundFile.cpp:(.text+0x6cb): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundFile.cpp.obj):SoundFile.cpp:(.text+0x6fc): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundFile.cpp.obj):SoundFile.cpp:(.text+0xab2): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundFile.cpp.obj):SoundFile.cpp:(.text+0x1dff): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundFile.cpp.obj):SoundFile.cpp:(.text+0x1e56): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundFile.cpp.obj):SoundFile.cpp:(.text+0x1e6e): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundFile.cpp.obj):SoundFile.cpp:(.text+0x23c5): undefined reference to `sf::err()'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(SoundFile.cpp.obj):SoundFile.cpp:(.text+0x2413): undefined reference to `sf::err()'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(ALCheck.cpp.obj):ALCheck.cpp:(.text+0x3d): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(ALCheck.cpp.obj):ALCheck.cpp:(.text+0x5f): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(ALCheck.cpp.obj):ALCheck.cpp:(.text+0x73): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(ALCheck.cpp.obj):ALCheck.cpp:(.text+0xbe): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(ALCheck.cpp.obj):ALCheck.cpp:(.text+0xe7): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(ALCheck.cpp.obj):ALCheck.cpp:(.text+0x109): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(ALCheck.cpp.obj):ALCheck.cpp:(.text+0x12b): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(ALCheck.cpp.obj):ALCheck.cpp:(.text+0x14a): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(ALCheck.cpp.obj):ALCheck.cpp:(.text+0x211): undefined reference to `sf::err()'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(ALCheck.cpp.obj):ALCheck.cpp:(.text+0x5c5): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(AudioDevice.cpp.obj):AudioDevice.cpp:(.text+0x149): undefined reference to `__gxx_personality_sj0'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(AudioDevice.cpp.obj):AudioDevice.cpp:(.text+0x16b): undefined reference to `_Unwind_SjLj_Register'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(AudioDevice.cpp.obj):AudioDevice.cpp:(.text+0x1a7): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(AudioDevice.cpp.obj):AudioDevice.cpp:(.text+0x247): undefined reference to `_Unwind_SjLj_Unregister'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(AudioDevice.cpp.obj):AudioDevice.cpp:(.text+0x297): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(AudioDevice.cpp.obj):AudioDevice.cpp:(.text+0x2ce): undefined reference to `_Unwind_SjLj_Resume'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(AudioDevice.cpp.obj):AudioDevice.cpp:(.text+0x31d): undefined reference to `sf::err()'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(AudioDevice.cpp.obj):AudioDevice.cpp:(.text+0x371): undefined reference to `sf::err()'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(AudioDevice.cpp.obj):AudioDevice.cpp:(.text+0x3f5): undefined reference to `sf::err()'
D:/SFML-2.0-rc/lib/libsfml-audio-s.a(AudioDevice.cpp.obj):AudioDevice.cpp:(.text+0x449): undefined reference to `sf::err()'
collect2: ld returned 1 exit status
mingw32-make.exe[1]: *** [debug\TestLoadSound.exe] Error 1
mingw32-make.exe: *** [debug] Error 2
19:10:05: The process "D:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project TestLoadSound (target: Desktop)
When executing build step 'Make'

What's wrong? Qt's MinGW 4.4 not suitable?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11035
    • View Profile
    • development blog
    • Email
Re: How to statically link sfml-audio with Qt 4.7.4 (MinGW 4.4)?
« Reply #3 on: August 22, 2012, 01:22:07 pm »
sfml-audio is based on the sfml-system module, so you'll have to link against both libraries. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

ccleung6

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: How to statically link sfml-audio with Qt 4.7.4 (MinGW 4.4)?
« Reply #4 on: August 22, 2012, 01:37:58 pm »
sfml-audio is based on the sfml-system module, so you'll have to link against both libraries. ;)

I added LIBS += -lsfml-system-s

but still no luck

ccleung6

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: How to statically link sfml-audio with Qt 4.7.4 (MinGW 4.4)?
« Reply #5 on: August 22, 2012, 02:11:24 pm »
Tried SFML 1.6, static linkage OK.
And when close program won't memory crash.  ;D

I wonder why SFML 2.0 cannot link statically.  :(

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: How to statically link sfml-audio with Qt 4.7.4 (MinGW 4.4)?
« Reply #6 on: August 22, 2012, 06:46:19 pm »
Quote
I wonder why SFML 2.0 cannot link statically.
You can't link SFML 2.0 statically ;)
There can be many reasons. But if you downloaded the right version and follow the tutorial step by step, there's no reason to fail.
Laurent Gomila - SFML developer

ccleung6

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: How to statically link sfml-audio with Qt 4.7.4 (MinGW 4.4)?
« Reply #7 on: August 25, 2012, 03:18:02 pm »
Quote
I wonder why SFML 2.0 cannot link statically.
You can't link SFML 2.0 statically ;)
There can be many reasons. But if you downloaded the right version and follow the tutorial step by step, there's no reason to fail.

I get the latest source and compile into static libs with MinGW, it finally successful to link statically and on exit crash problem solved.

Thanks.