Project only contains main.cpp
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}
I get the following error:
Run-Time Check Failure #2 - Stack around the variable 'window' was corrupted.
A buffer overrun has occurred in SFMLTutorial2.exe which has corrupted the program's internal state.
...whenever I close the window with the example circle being drawn. This only occurs with a debug build, not a release build.
I am using Visual Studio 2013 which means I have to remake the SFML binaries. No problem I download the latest here:
https://github.com/SFML/SFML/archive/master.zipI made static libraries in cmake. One thing I noticed is that the project still requires opengl32.lib and winmm.lib which was not made by cmake. I assume these already exist with the platform/compiler.
Linker->Input->Additional Dependencies:
freetype.lib
glew.lib
jpeg.lib
openal32.lib
sndfile.lib
opengl32.lib
winmm.lib
gdi32.lib
sfml-main-d.lib
sfml-audio-s-d.lib
sfml-network-s-d.lib
sfml-graphics-s-d.lib
sfml-window-s-d.lib
sfml-system-s-d.lib
C/C++->Preprocessor->Preprocessor Definitions:
WIN32
_DEBUG
_WINDOWS
SFML_STATIC
Any thoughts? In my research it seems that others who have had this problem mix linking debug/release libs. As far as I can tell I have not. Any help would be greatly appreciated.