2016-12-30 5 views
0

SFML에서 가져온 샘플 코드에 대해 지금까지 추가 한 거의 모든 객체 (sf :: Color, sf :: Image, sf :: Texture 등) 가 0xc0000005 : gameboiss.exe에서 0x61C71B86 (sfml 시스템-2.dll)에서SFML - RenderWindow 런타임 오류가 발생했습니다.

처리되지 않은 예외 : 나는 그것을 실행하면 사이트는 예외의 협정에 던져 액세스 위반이 위치 0x00000074을 읽고.

어떤 이유로 든 RenderWindow 라인을 참조하여 표시됩니다. 이러한 객체를 참조하는 모든 선을 제거하면 벌금이 부과됩니다. 변수를 만드는 행 (sf :: Texture texture)을 하나만 남겨도 예외는 여전히 발생합니다. 나는 디버그에서 지역 주민/자동차를 보는 ​​것 사이에서 여러 가지 것을 시도했다. 그리고 그것은 많은 빛을주는 것처럼 보이지 않는다.

저는 Visual Studio 2012에서 모든 도움말을 설명합니다. 아래는 코드입니다. 감사합니다 :) 제가 위에서 RetiredNinja의 의견에 동의

#include <iostream> #include "SFML/Window.hpp" #include "SFML/Graphics.hpp" #include "SFML/System.hpp" int main(){ sf::RenderWindow window(sf::VideoMode(200,200), "game boi"); sf::CircleShape shape(100.f); //source of error sf::Texture texture; texture.loadFromFile("char\\spartapix.png"); /*if(!hero.loadFromFile("char\\spartapix.png")){ std::cerr << "Error: sprite not loaded.\n"; return 1; }*/ //sf::Image background; //if (!background.loadFromFile("background.jpg")) //return -1; shape.setFillColor(sf::Color::Blue); sf::Vector2i pos; while (window.isOpen()){ sf::Event event; while (window.pollEvent(event)){ if (event.type == sf::Event::Closed) window.close(); if (event.type == sf::Event::GainedFocus) std::cout << "playing"; if (event.type == sf::Event::LostFocus) std::cout << "notplaying\n"; if (event.type == sf::Event::MouseButtonPressed){ sf::Vector2i pos = sf::Mouse::getPosition(window); std::cout << pos.x << " " << pos.y << std::endl; } if (event.type == sf::Event::KeyPressed){ if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)){ } if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)){ } if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)){ window.close(); } } } window.clear(); window.draw(shape); window.display(); } return 0; } <code>
+1

컴파일러와 정확히 일치하는 sfml 버전을 사용하고 계십니까? 버전이 맞지 않을 때 비슷한 문제가 발생했습니다. –

답변

0

: 그것은 최대한 빨리 렌더링 창을 만들 때 발생하는 경우, 전달 된 문자열에서 일부 STL 버전 차이 (가장 가능성이 높습니다; sf::String 이후 sfml의 일부입니다 -system) 버전을 혼합 할 때 일반적으로 사용됩니다 (Visual Studio 릴리스 또는 릴리스/디버그 빌드).

correct download from SFML's download page을 선택하셨습니까? 또는 official repository에서 SFML을 다운로드하고 컴파일 해 볼 수 있습니다.