I am trying without sucess to install SFML 2.0 on a Ubuntu 15.10.
I follow the tutorial:http://www.sfml-dev.org/tutorials/2.0/start-linux.php . I downloaded the Linux archive from the link http://www.sfml-dev.org/download/sfml/2.0/. After that I extracted the archive to /usr/local/ directory on my computer. I try to compile the following code:
#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;
}
When I compile the code with:
g++ main.cpp -o main.o -L/usr/local/lib -lsfml-graphics -lsfml-window -lsfml-system
I get
fatal error: SFML/Graphics.hpp: No such file or directory.
When compiling with
g++ main.cpp -o main.o -I/usr/local/include -lsfml-graphics -lsfml-window -lsfml-system
I get:
/usr/bin/ld: cannot find -lsfml-graphics
/usr/bin/ld: cannot find -lsfml-window
/usr/bin/ld: cannot find -lsfml-system
When I compile the code simply with:
g++ main.cpp -o main.o -lsfml-graphics -lsfml-window -lsfml-system
I am getting:
fatal error: SFML/Graphics.hpp: No such file or directory.
I tried thesudo make install
in the SFML2.0 directory, but all I get is install: missing file operand
It is really important to install the 2.0 version of SFML. I thought about installing the SFML form the packet manager, but with sudo apt-get install libsfml-dev
I would get a newer version of SFML and not the 2.0.
Can you tell what should I do to install properly SFML 2.0 on my machine?
Thank you in advance.
fatal error: SFML/Graphics.hpp: No such file or directory.
definitely means that your extraction process failed to copy the directory structure over correctly. The folder SFML-2.0
should not be in /usr/local/
.
tar xvf SFML*.tar.bz2
cd SFML-2.0
SFML-2.0/
(include
lib
and share
) into their respective directories in /usr/local
sudo cp -r share/SFML/ /usr/local/share/
sudo cp -r lib/* /usr/local/lib/
sudo cp -r include/SFML /usr/local/include/
(Note this will make a mess out of lib
)
Try to recompile main after verifying that the directory SFML-2.0/include/SFML
is now located at /usr/local/include/SFML
, etc