2

I tried to compile sfml 2.0. At first I wrote this command:

g++ -c sprite.cpp -I sfml/include

Every files are on my desktop now and the folder that contains the sfml files is called sfml and it is on my desktop also.

After this command, I wrote:

g++ -o sprite sprite.o -L sfml/lib -lsfml-graphics -lsfml-window -lsfml-system

After this, I simply did:

./sprite

The problem is here. When I try to run it i get:

./sprite: error while loading shared libraries: libsfml-graphics.so.2: cannot open shared object file: No such file or directory

1 Answer 1

3

The loader could not find the library libsfml-graphics.so.2. It seems that this library is located under sfml/lib.
Once solution consists in adding the location to the environment variable LD_LIBRARY_PATH and exporting it before running your executable:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:sfml/lib

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.