【发布时间】:2021-07-25 06:26:55
【问题描述】:
我在 CLion 中安装了 SFML,但是当我尝试运行一些基本代码以查看它是否正常工作时遇到了一些问题。
#include <SFML/Window.hpp>
int main()
{
sf::Window window(sf::VideoMode(800, 600), "My window");
// run the program as long as the window is open
while (window.isOpen())
{
// check all the window's events that were triggered since the last iteration of the loop
sf::Event event;
while (window.pollEvent(event))
{
// "close requested" event: we close the window
if (event.type == sf::Event::Closed)
window.close();
}
}
return 0;
}
这没有错误,但它不能正常工作,当我运行它时得到这个Process finished with exit code -1073741515 (0xC0000135)。关于如何解决这个问题的任何想法?
如果对您有帮助,这是代码图片
【问题讨论】:
-
尝试使用
RenderWindow而不是Window,也应该将事件放在循环之外以避免每个循环的无意义的构造/破坏。