我遇到了一个又一个 SFML 问题,但希望它最终是值得的。
这是错误:
致命错误:SFML/Graphics.hpp:没有这样的文件或目录
和代码:
#include < SFML/Graphics.hpp >
#include < SFML/Window.hpp >
int main(){
sf::RenderWindow Window;
Window.create(sf::VideoMode(800, 600), "SFML");
while(Window.isOpen()){
sf::Event Event;
while(Window.pollEvent(Event)){
if(Event.type == sf::Event::Closed)
Window.close();
}
}
}
原文由 Lucas Davis 发布,翻译遵循 CC BY-SA 4.0 许可协议
就我而言,包含路径都是正确的,但我忽略了指定 SFML 的子目录;我放了
#include <SFML/Vector2.hpp>
而不是#include <SFML/System/Vector2.hpp>
。