So, I have been working on a little project of mine, and I have encountered a bug.
I have a special class for cinematics, where I use two music: a base and a special. I declare them in the header:
#ifndef INTROSCENE_H
#define INTROSCENE_H
#include "Screens/CinematicScreen.h"
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
class CharaIntroScene : public CinematicScreen
{
public:
IntroScene(GameManager* gameManager);
virtual ~IntroScene();
private:
sf::Music Base;
sf::Music Special;
};
#endif
And my source file:
#include "Screens/Cinematics/IntroScene.h"
IntroScene::IntroScene(GameManager* gameManager) : CinematicScreen(gameManager)
{
Base.openFromFile("Assets/Music/Base.ogg");
Special.openFromFile("Assets/Music/Special.ogg");
Base.setLoop(true);
Special.setLoop(true);
}
and I have a void where I start the music.
This way the game freeze and crash on load.
If I comment out the openFromFile part it loads.
I'm using windows 10 with codeblocks, and the corresponding SFML version.
Everything else is included, the dll files are in place.
And if I use the debugger, everything works, even the music plays. But it only works with the debugger.
So, what can be the problem?