I am trying to run this simple SFML C++ program in Visual Studio 2012. It does work fine in debug mode, but as soon as I use the non-debug libraries and DLLs the program throws an Access Violation exception on the first line of code. If I remove the assignment (and the dependencies of the assignment), and just run 'sf::VideoMode::getFullscreenModes();' it works fine.
I have the libraries dynamically linked.
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/OpenGL.hpp>
#include <iostream>
int main(int argCount, char** argVector) {
std::vector<sf::VideoMode> vm = sf::VideoMode::getFullscreenModes(); // Access Violation in Non-Debug Mode
sf::VideoMode videoMode;
for(unsigned i = 0; i < vm.size(); i++) {
if(vm[i].isValid()) {
videoMode = vm[i];
break;
}
std::cout << "Invalid VideoMode: " << i << std::endl;
}
sf::Window window(videoMode, "SFML OpenGL", sf::Style::Fullscreen);
glClearDepth(0.5F);
glOrtho(0, 1, 0, 1, 0, 1);
std::cout << glGetError();
glColor3f(0, 1, 0);
{
glBegin(GL_QUADS);
glVertex3i(0, 0, 0);
glVertex3i(0, 1, 0);
glVertex3i(1, 1, 0);
glVertex3i(1, 0, 0);
glEnd();
}
window.display();
while(window.isOpen()) {}
return 0;
}