I have been working on a game using SFML and have managed to implement Music objects without problems. However, I can't seem to get a Sound object to work. I've tried a bare bones SFML project as per code below to make sure it's not anything related to my game and it still doesn't play a sound. The program just runs through and returns at the end, with no error messages.
SFML version 2.3.2
Visual Studio 2015
#include <SFML/Audio.hpp>
#include <iostream>
int main()
{
sf::SoundBuffer buffer;
sf::Sound sound;
if (!buffer.loadFromFile("assets/sounds/pickup.wav")) {
//error handling
std::cout << "can't find sound file" << std::endl;
}
sound.setBuffer(buffer);
if (sound.getStatus() != sf::Sound::Playing) {
sound.play();
}
return 0;
}
The error handling message doesn't trigger so it seems to be loading ok, and its from the same folder as the correctly working music wav file. During debugging I have set a breakpoint at the sound.play() function and it definitely calls this, with the sound object seeming to hold the correct data (e.g. sound duration looks right etc). However it does have the following message:
sound <Information not available, no symbols loaded for sfml-audio-d-2.dll> sf::Sound
I've tried googling and it seems that there might be an issue with the .dll or .lib so I've checked these again and I'm sure I have this right:
All sfml 2.3.2 dll files are all in the same folder as main.
Project properties:
Debug
C/C++ - Additional Include Directories = C:\Users\[name]\Documents\SFML-2.3.2\include
Linker - Additional Library Directories = C:\Users\[name]\Documents\SFML-2.3.2\lib
Linker - Additional Dependencies = sfml-audio-d.lib;sfml-graphics-d.lib;sfml-window-d.lib;sfml-system-d.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
Release
C/C++ - Additional Include Directories = C:\Users\[name]\Documents\SFML-2.3.2\include
Linker - Additional Library Directories = C:\Users\[name]\Documents\SFML-2.3.2\lib
Linker - Additional Dependencies = sfml-audio.lib;sfml-graphics.lib;sfml-window.lib;sfml-system.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
Can anyone advise as I feel like I'm banging my head against a wall here. I hope this is enough info but let me know if you want to know anything else about the setup.