SFML community forums

Help => Audio => Topic started by: quietam on July 26, 2013, 12:57:22 am

Title: SFML 2.0 loadfromfile not working
Post by: quietam on July 26, 2013, 12:57:22 am
Hi! Kind of new to SFML and a bit new to c++ as well.
Basic info: Running linux mint 15 using Eclipse kepler

I got SFML working after a bit of a hassle(apt-get installed 1.6 instead).

Did the first tutorials everything working fine until I got to the audio tutorial.

sf::SoundBuffer buffer;
    if (!buffer.loadFromFile("sound.wav"))
        return -1;

While writing the code i get an error message "Method 'loadFromFile' could not be resolved"
The error message only marks loadFromFile as the problem not the file itself.(Have also tried with a few other sound formats)

loadFromFile has worked perfectly fine up to now loading images etc so i don't understand why it wont work now.
I have included Audio.hpp and tried including SoundBuffer.hpp as well.

I also get the same error message on other audio functions like music and play()
Title: Re: SFML 2.0 loadfromfile not working
Post by: eXpl0it3r on July 26, 2013, 05:10:36 am
Where do you get that error?
You are aware that compiler and linker outputs are completely different from runtime console outputs? And that there's a difference between "building" and actually "running" the application?

How have you setup Eclipse? Does it link against SFML correctly? Are the libraries being compiled in the right oder?
Title: Re: SFML 2.0 loadfromfile not working
Post by: quietam on July 26, 2013, 03:14:06 pm
Found the error!
When trying to compile the program it can't find -lsfml-audio.
So i must of linked it wrong somewhere but i have no idea where as i linked all the libraries in the exact same way and the others are working fine.

in usr/lib all the files are there what i can see.

This is how eclipse is set up for me. You can also see the error messages and how i include the header files there.
(http://i1128.photobucket.com/albums/m484/acw95acw/Screenshotfrom2013-07-26150526_zps6b743897.png)