【发布时间】:2014-03-13 03:58:09
【问题描述】:
我刚刚安装了最新版本的 CodeBlocks(13.12 和 TDM-GCC-4.8.1),现在我的代码无法运行。在我拥有的旧版本中,一切都编译和运行完美无瑕,但现在,使用相同的代码,它编译但在运行时崩溃,说我的程序“已停止工作”,并返回 -1073741510 (0xC0000005)。
我在处理一个更复杂的程序时遇到了这个问题,所以我尝试运行 SFML 给出的示例来尝试隔离问题,并且以完全相同的方式中断,所以这似乎是要做的事情使用 SFML,但我不明白是什么或为什么。
这是代码:
#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;
}
这是调用堆栈:
#0 691C4AF9 sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int) () (D:\MyDocs\DOCUME~1\C__~1\SFML2~1.0TE\SFML2T~1\bin\Debug\sfml-window-2.dll:??)
#1 00401424 main() (D:\MyDocs\Documents\C++\SFML 2.0 Test\SFML 2 Test\main.cpp:5)
有谁知道为什么会发生这种情况或我该如何解决?
【问题讨论】:
标签: c++ runtime-error codeblocks sfml