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

Author Topic: Loading .ogg Issue  (Read 4084 times)

0 Members and 1 Guest are viewing this topic.

MasterOfKings

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • http://mgproductions.tk/
Loading .ogg Issue
« on: July 01, 2011, 05:07:24 pm »
Hey all,

Recently got a hold of SFML 1.6 (for VC++ 2008). I'm looking to use it in conjunction with Ogre for a game (SFML will be the menu and audio).

Now, for testing, I tried some simple code.
Code: [Select]
sf::Music music;
music.OpenFromFile("rsrcs\music\alone.ogg");
music.Play();


The code itself doesn't bring any errors. I'm using VC++ 2010 Express, and I set-up SFML by using .

Again, there is no syntax error, or what have you (I have got the correct include statement earlier in the code).

However, it generates these build errors...
Quote
1>sfml-audio-s.lib(SoundStream.obj) : error LNK2001: unresolved external symbol "public: virtual __thiscall sf::Thread::~Thread(void)" (??1Thread@sf@@UAE@XZ)
1>sfml-audio-s.lib(SoundStream.obj) : error LNK2001: unresolved external symbol "protected: __thiscall sf::Thread::Thread(void)" (??0Thread@sf@@IAE@XZ)
1>sfml-audio-s.lib(SoundStream.obj) : error LNK2001: unresolved external symbol "public: void __thiscall sf::Thread::Wait(void)" (?Wait@Thread@sf@@QAEXXZ)
1>sfml-audio-s.lib(SoundStream.obj) : error LNK2001: unresolved external symbol "void __cdecl sf::Sleep(float)" (?Sleep@sf@@YAXM@Z)
1>sfml-audio-s.lib(SoundStream.obj) : error LNK2001: unresolved external symbol "public: void __thiscall sf::Thread::Launch(void)" (?Launch@Thread@sf@@QAEXXZ)
Obviously, that notes that the issue is within SoundStream.obj, but I have no idea what to do to fix it.

Help?

-MoK

PS: The code is not within the main(), it is within a function used at the beginning of the game. However, I doubt that has any effect on it.

Contadotempo

  • Full Member
  • ***
  • Posts: 167
  • Firelink Shrine
    • View Profile
Loading .ogg Issue
« Reply #1 on: July 01, 2011, 05:27:08 pm »
Are you linking with "sfml-audio.lib" on the additional dependencies?
Did you compile the correct configuration? Example: Compile SFML for "release" and use the "release" configuration when compiling your code.


If nothing works, try to replicate the problem with a minimal code programme.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Loading .ogg Issue
« Reply #2 on: July 01, 2011, 05:45:27 pm »
You need to link against sfml-system too, because sfml-audio uses some classes of the System package.
Want to play movies in your SFML application? Check out sfeMovie!

MasterOfKings

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • http://mgproductions.tk/
Loading .ogg Issue
« Reply #3 on: July 02, 2011, 01:49:53 pm »
@Contadotempo: Yeah. I've done all that. I had thought it might of been that, so I completely re-did it. Still got the errors.

@Ceylo: I added in the SFML system part, and the linker errors are gone now. Thanks.

-MoK

atmamta

  • Newbie
  • *
  • Posts: 2
    • View Profile
Loading .ogg Issue
« Reply #4 on: November 22, 2011, 05:52:28 pm »
..you need to tell the main thread to wait (or do something else) while the other thread playing the audio is executing. Otherwise it will immediately finish (and that will kill the audio thread as well, so you won't hear anything).

In your short example, you could use this code:

sf::Music music;
music.Play();
sf::Sleep(music.GetDuration());
return 1;

 

anything