1
General / SFML on Raspberry Pi?
« on: January 31, 2024, 04:03:07 pm »
Hi, I work on Raspberry Pi 4, with latest Raspbian.
I downloaded SFML by sudo apt-get xxxx and I try to compile my code C++ with SFML.
g++ -o main main.cpp -lpigpio -Ipigpio -Isfml -lsfml-graphics -lsfml-window -lsfml-system
sudo ./main
Compilation looks fine, executable file is always created, BUT sudo ./main tells me always
error: XDG_RUNTIME_DIR is invalid or not set in the environment. When I try to create window.
My code:
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
int main(){
sf::RenderWindow window(sf::VideoMode(200, 200), "WORKS!");
}
Can you help me? If I comment out this RenderWindow function, it works fine.
I downloaded SFML by sudo apt-get xxxx and I try to compile my code C++ with SFML.
g++ -o main main.cpp -lpigpio -Ipigpio -Isfml -lsfml-graphics -lsfml-window -lsfml-system
sudo ./main
Compilation looks fine, executable file is always created, BUT sudo ./main tells me always
error: XDG_RUNTIME_DIR is invalid or not set in the environment. When I try to create window.
My code:
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
int main(){
sf::RenderWindow window(sf::VideoMode(200, 200), "WORKS!");
}
Can you help me? If I comment out this RenderWindow function, it works fine.