Hi I really need help with getting audio to work in my program. I've been working on it for awhile and I just can't figure it out.
When I try to run my program it just crashes and the exception it gives me is:
Exception thrown at 0x5719D687 (vcruntime140.dll) in Spacehip Game.exe: 0xC0000005: Access violation reading location 0x00542000. occurred
My code is (I had more but I started a new project to see if that would fix it):
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
int main() {
sf::Music music;
if (!music.openFromFile("music.wav"))
return -1; // error
music.play();
//sf::RenderWindow window(sf::VideoMode(800, 600), "This is dumb");
}
I'm sure that my .wav file is in the right place and it plays when I use windows media player. A strange thing about the error is it gives me a bunch of random symbols, I attached a screenshot so people can see it.
Thanks for taking the time to help me. If I need to provide any more info I will.