I have been following a tutorial on making a 2d game in C++ when all of a sudden I got an error. It worked in the tutorial with all of the same code so it could be something wrong with my setup but I didn't think it would be.
I am using SFML and here is my main.cpp:
#include <iostream>
#include <SFML/Network.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
using namespace sf;
int main()
{
RenderWindow window(VideoMode(640, 480), "Test Game", Style::Titlebar | Style::Close);
Event ev;
// Game Loop
while (window.isOpen()) {
// Event Polling
while (window.pollEvent(ev)) {
switch (ev.type) {
case Event::Closed:
window.close();
break;
case Event::KeyPressed:
if (ev.key.code == Keyboard::Escape)
window.close();
break;
}
}
// Update
// Render
window.clear();
// Draw New Content
// Tell app that window is done drawing
window.display();
}
return 0;
}
Error:
Exception thrown at 0x00E62B0A in 2D game.exe: 0xC0000005: Access violation writing location 0x00000065.
User contributions licensed under CC BY-SA 3.0