Well i've been fighting this problem for a few days and haven't been able to track down anything similair on these forums or google so here is my cry for help.
I'm using MSVS C++ 2010 and compiled the SFML 2.0 build a few days ago. It was the first time i've compiled it so it is possible I got something wrong, though after a few attempts and video tutorials I think I have that sorted. I'm also running Windows 7 64bit, but it is an x86 install of VS.
In debug mode my game works perfectly fine. For the release build however the game crashes upon exiting. While it doesn't effect gameplay it is frustrating.
This is the error I get "Unhandled exception at 0x768f4dcc in BrickOut.exe: 0xC0000005: Access violation reading location 0xfeeefeee."
If I stop it has the break point at line 518 in crtexe.c
If I comment out the sf::SoundBuffer and sf::Sound related code then everything runs normally, though without sound of course (audio is the only package that i'm currently trying to integrate).
The code for the game is well in excess of 6000 lines so i'll just post the examples of the SFML code as it is written in my code. Though i'm not sure how helpful it'll be as I have this problem even if I comment out everything except one sfml declaration.
// SFML Includes
#include <SFML/Audio.hpp>
...
sf::SoundBuffer bufferBrickKO;
...
sf::Sound soundQueue[SOUNDQUEUESIZE]; (constant is set to 25 for now)
...
void initSound() // Initialise the sound buffers and the sound queue
{
if(!bufferBrickKO.loadFromFile(SOUND_BRICKKO))
{
MessageBox(NULL, "KO Sound Not Loaded", NULL, NULL);
soundLoaded = false; // Sound failed to load
}
...
}
...
void AddSound(std::string sound) // Create a sound for the given sound buffer and add it to the queue
{
int n; // Counter
// Find the last free sound position in the queue
n = 0;
while(n < SOUNDQUEUESIZE)
{
if(soundQueue[n].getStatus() == sf::Sound::Status::Stopped) // Found an empty position
{
if(sound == SOUND_BRICKKO)
{
soundQueue[n].setBuffer(bufferBrickKO);
}
...
soundQueue[n].play();
break;
}
n++;
}
}