0

I try to build a project with SFML 2.0

g++ src/*.cpp -o test -L./SFML-2.0/lib/ -lsfml-graphics -lsfml-window

And I got undefined references on everything coming from SFML.

Thanks

EDIT: I tried to first compile my sources with -c option, it compiles, but when I launch it, g++ tells me he doesnt find libsfml-window.so.1.6 - The problem is that I'm not using 1.6 at all...

EDIT2: By the way, SFML-2.0 has no Makefile in it

1
  • There are tutorials on SFML's website about how to install or compile it, they contain everything you need. Commented Jul 24, 2013 at 18:08

2 Answers 2

2
  • Make sure you get SFML 2.0 itself.

Many of the Linux distros still use SFML 1.6 in their package manager, so you'll have to compiler SFML on your own.

  • SFML uses CMake to generate make or project files.

There's a tutorial explain exactly how to build SFML from source with CMake.

  • How to build your project with SFML on Linux has its own tutorial.

SFML's graphics and window module build on top of the system module, thus you'll have to link against that as well. You need to make sure the compiler gets SFML's header files as well.

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

Comments

0
  1. Make sure you have sfml installed correctly

    Sudo apt-get install libsfml-dev

I believe is the correct install.

  1. You need to link sfml-graphics sfml-window and sfml-system in most scenarios

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.