I spent the last 2 hours trying to figure out what is wrong with my code. Some solutions on Google/StackOverflow didn't change the problem.
Here's this simple code :
sf::RenderWindow window(sf::VideoMode(1280, 720), "BBS");
// redirect sfml stderr to this file
std::streambuf* previous = sf::err().rdbuf(file.rdbuf());
sf::err() << "ABCD" << std::endl;
// this line fail and make stderr crash
sf::err() << "XYZ" << std::endl;
Failed to load font "
Ok, I just solved it.
I was compiling with debug settings in VS and was linking with
sfml-graphics.lib sfml-window-s.lib sfml-window.lib sfml-system-s.lib sfml-system.lib
sfml-graphics-d.lib sfml-window-s-d.lib sfml-window-d.lib sfml-system-s-d.lib sfml-system-d.lib