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

Author Topic: undefined reference to sfMusic_setPlayingOffset  (Read 4185 times)

0 Members and 1 Guest are viewing this topic.

colin

  • Newbie
  • *
  • Posts: 2
    • View Profile
undefined reference to sfMusic_setPlayingOffset
« on: April 30, 2012, 05:02:26 pm »
While trying to compile the following:

#include <SFML/Audio.h>
#define EXIT_FAILURE 1;
#define EXIT_SUCCESS 0;
 
 int main()
 {
     sfMusic* music;

     /* Load a music to play */
     music = sfMusic_createFromFile("nice_music.ogg");
     if (!music)
         return EXIT_FAILURE;

     /* Play the music */
     sfMusic_setPlayingOffset(music, 5000);
     sfMusic_play(music);

     sleep(20);
 
     /* Cleanup resources */
     sfMusic_destroy(music);
 
     return EXIT_SUCCESS;
 }

I get the error:

Code: [Select]
/tmp/cc6c8K17.o: In function `main':
demo.c:(.text+0x37): undefined reference to `sfMusic_setPlayingOffset'
collect2: ld returned 1 exit status

I'm using the command:

Code: [Select]
gcc -o demo demo.c -lcsfml-audio
If I remove or comment out the sfMusic_setPlayingOffset line everything works fine. I also tried every other function in Music.h and they all compile correctly.

One thing I noticed, in Music.cpp, is that the function is sfMusic_setPlayingOffset(sfMusic* music, sfTime timeOffset) while in Music.h it's sfMusic_setPlayingOffset(sfMusic* music, sfUint32 timeOffset)

I tried making changes to Music.h and recompiling but it doesn't seem to solve the issue.
« Last Edit: April 30, 2012, 05:40:33 pm by Laurent »

colin

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: undefined reference to sfMusic_setPlayingOffset
« Reply #1 on: April 30, 2012, 05:36:05 pm »
Never mind, changing sfUint32 to sfTime in Music.h did fix the problem. I guess gcc just had the library cached or something because, after restarting my session, it compiled fine.

I'll fix it on git and submit a pull request.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: undefined reference to sfMusic_setPlayingOffset
« Reply #2 on: April 30, 2012, 05:43:13 pm »
Quote
I'll fix it on git and submit a pull request.
You don't need to, it's already fixed ;)

Thanks for solving the bug.
Laurent Gomila - SFML developer