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

Author Topic: SFML 2.0 loadfromfile not working  (Read 2040 times)

0 Members and 1 Guest are viewing this topic.

quietam

  • Newbie
  • *
  • Posts: 2
    • View Profile
SFML 2.0 loadfromfile not working
« 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()

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10916
    • View Profile
    • development blog
    • Email
Re: SFML 2.0 loadfromfile not working
« Reply #1 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?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

quietam

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: SFML 2.0 loadfromfile not working
« Reply #2 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.