SFML, sf::Music cannot be copied

Started by
12 comments, last by alvaro 11 years, 6 months ago
Just making sf::Music* always makes main return value be -2147418113 <0x8000FFFF>

I cannot find on sfml page how to deal with this error.
I can easily deal with this by making only one sf::Music and reloading it each time you change music.

#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
int main()
{
sf::RenderWindow Screen;
Screen.create(sf::VideoMode(800,600,32), "Title of the screen", sf::Style::Default);
bool is_On = true;

//Just making this here will cause the error
sf::Music* tempMusic = new sf::Music;
delete tempMusic;
//Up until here

while(is_On == true)
{
sf::Event EventList;
while(Screen.pollEvent(EventList))
{
switch(EventList.type)
{
case sf::Event::Closed:
is_On = false;
break;
default:
break;
}
}
Screen.clear(sf::Color::White);
Screen.display();
}
Screen.close();
}
Advertisement
Why don't you post a minimal complete program that shows the error? That way we can try to reproduce it and help you much better.

By "minimal" I mean that if you were to remove anything from the program, the error wouldn't happen. So for instance you can probably remove anything about the RenderWindow.

Why don't you post a minimal complete program that shows the error? That way we can try to reproduce it and help you much better.

By "minimal" I mean that if you were to remove anything from the program, the error wouldn't happen. So for instance you can probably remove anything about the RenderWindow.

I did exactly that. Added #inlucdes if that is what you asked.
I did bare bones of SFML to run and close.
I have SFML-1.6 installed. I adapted your code (mostly changing capitalization of methods) and I can't reproduce the problem. SFML-2.0 is not final, precisely because they want people to report problems using it.

I looked at their bug reports and found this, which seems closely related to what you are describing. Read the whole thread to see if other people's experiences might help you. (Notice how much shorter their sample program is than yours: That's what I mean by "minimal".)

This topic is closed to new replies.

Advertisement