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

Author Topic: sf::SoundStream linking error?  (Read 3635 times)

0 Members and 2 Guests are viewing this topic.

Gregory

  • Newbie
  • *
  • Posts: 41
    • View Profile
sf::SoundStream linking error?
« on: October 17, 2013, 06:41:29 am »
Hello guys.

The sf::SoundStream appears to show a linking error with sf::Thread

This is the code I am trying to compile:

audioStream.hpp:
#pragma once

#include <string>
#include <SFML/System.hpp>
#include <SFML/Audio.hpp>

class audioStream : public sf::SoundStream {
    public:
        void setFile(std::string file);
        bool startLoading();
        bool isLoaded();
        audioStream();


    private:
        void load();
        bool onGetData(Chunk& chunk);
        void onSeek(unsigned int timeOffset);

    sf::SoundBuffer buffer;

    std::string m_file;
    bool m_loaded;
    sf::Thread *m_loadThread;
    sf::Mutex m_loadMutex;

    int streamPosition;
    int fileSize;

};

 

audioStream.cpp:
#include "audioStream.hpp"

bool audioStream::onGetData(Chunk& chunk) {
    return 0;
}

void audioStream::onSeek(unsigned int timeOffset) {}

audioStream::audioStream() {}
 

Build Messages:
C:\SFML-2.1\lib\libsfml-audio-s-d.a(SoundStream.cpp.obj)||In function `ZN2sf11SoundStreamD2Ev':|
D:\downloads\SFML-2.1\src\SFML\Audio\SoundStream.cpp|56|undefined reference to `sf::Thread::~Thread()'|
D:\downloads\SFML-2.1\src\SFML\Audio\SoundStream.cpp|56|undefined reference to `sf::Thread::~Thread()'|
C:\SFML-2.1\lib\libsfml-audio-s-d.a(SoundStream.cpp.obj)||In function `ZN2sf11SoundStream4playEv':|
D:\downloads\SFML-2.1\src\SFML\Audio\SoundStream.cpp|105|undefined reference to `sf::Thread::launch()'|
C:\SFML-2.1\lib\libsfml-audio-s-d.a(SoundStream.cpp.obj)||In function `ZN2sf11SoundStream4stopEv':|
D:\downloads\SFML-2.1\src\SFML\Audio\SoundStream.cpp|121|undefined reference to `sf::Thread::wait()'|
C:\SFML-2.1\lib\libsfml-audio-s-d.a(SoundStream.cpp.obj)||In function `ZN2sf11SoundStream16setPlayingOffsetENS_4TimeE':|
D:\downloads\SFML-2.1\src\SFML\Audio\SoundStream.cpp|164|undefined reference to `sf::Thread::launch()'|
||=== Build finished: 5 errors, 0 warnings (0 minutes, 0 seconds) ===|
 

Thanks!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: sf::SoundStream linking error?
« Reply #1 on: October 17, 2013, 08:02:54 am »
Do you link to sfml-system?
Laurent Gomila - SFML developer

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: sf::SoundStream linking error?
« Reply #2 on: October 17, 2013, 10:38:31 am »
If, and only if, you happen to still have undefined references after that, you can refer to this: http://en.sfml-dev.org/forums/index.php?topic=13242.msg93105#msg93105
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Gregory

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: sf::SoundStream linking error?
« Reply #3 on: October 18, 2013, 06:49:44 pm »
Problem resolved. I was linking but the linking order was wrong.

Thanks