c++ - Unhandled exception at 0x5401FA96 (sfml-system-d-2.dll) -
i trying make simple program sfml. source code same provided in example
given downloaded sfml site using precompiled version visual studio 12.
i configured project normally, , added correct libraries debug , release.
note:
there no compiler errors, , not linker errors well. added .dll libraries in .exe directory.
when run program, here output (just crashes):
exception thrown @ 0x50fafa96 (sfml-system-d-2.dll) in testsfml.exe: 0xc0000005: access violation reading location 0xccccccd8. if there handler exception, program may safely continued.
from looked on internet, error seems related mixing debug , release libraries, think did right.
note using visual studio community 2015, don't think cause problem.
the configuration inside project
release , debug (all configurations):
added same directory include path (release , debug) , library path (release , debug).
release
on linker -> input
added:
sfml-window.lib sfml-system.lib
debug
on linker->input
added:
sfml-system-d.lib sfml-window-d.lib
since using dynamic libraries, added libraries on directory of executable.
edit
main.cpp
#include <sfml/window.hpp> #include <sfml/opengl.hpp> int main() { // create window sf::window window(sf::videomode(800, 600), "opengl", sf::style::default, sf::contextsettings(32)); window.setverticalsyncenabled(true); // load resources, initialize opengl states, ... // run main loop bool running = true; while (running) { // handle events sf::event event; while (window.pollevent(event)) { if (event.type == sf::event::closed) { // end program running = false; } else if (event.type == sf::event::resized) { // adjust viewport when window resized glviewport(0, 0, event.size.width, event.size.height); } } // clear buffers glclear(gl_color_buffer_bit | gl_depth_buffer_bit); // draw... // end current frame (internally swaps front , buffers) window.display(); } // release resources... return 0; }
aditional dependencies on project. set on active(debug)
opengl32.lib sfml-system-d.lib sfml-window-d.lib
the compilation
1>------ build started: project: testsfml, configuration: debug x64 ------ 1> main.cpp 1> testsfml.vcxproj -> c:\users\leonardo\documents\visual studio 2015\projects\testsfml\x64\debug\testsfml.exe ========== build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
i got same error when trying compile sfml program sfml vs2013 when using vs2015. downloading (and using) correct version solved problem.
Comments
Post a Comment