I'm running into problem after problem with SFML, but hopefully it will be worth it in the end.
Here's the error:
fatal error: SFML/Graphics.hpp : No such file or directory
and the code:
#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();
}
}
}
You need to tell the compiler where to look for the SFML header files. This can be done by passing the -I flag in the compiler invocation:
-I/path/to/SFML/headers
If you're on Linux then this one liner is the way to go:
sudo apt-get install libsfml-dev
Found it in the docs here: https://www.sfml-dev.org/tutorials/2.1/start-linux.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With