SFML community forums

Help => General => Topic started by: Nathaniell on April 25, 2015, 04:19:50 pm

Title: Compilation problem (undefined reference to sf::)
Post by: Nathaniell on April 25, 2015, 04:19:50 pm
Hi

I'm working on team project in school and we are using sfml. So far I just wrote code outside the GUI section, but now I want to compile the whole thing and I'm getting standard undefined reference to sf:: error

I have Liinux Mint and I installed sfml via sudo apt-get install libsfml-dev and it didin't work so I tryed to download it from website and link it when compiling.. and I still get exactly same result.

For compilation I'm using this
Quote
g++ -Wall -pedantic -g -O0 -std=c++11 -I/home/debian/SFML-2.2/include -L/home/debian/SFML-2.2/lib -lsfml-graphics -lsfml-window -lsfml-system main.cpp ...and bunch of other .cpp files

Errors:
(click to show/hide)

So, what am I doing wrong? Do I need to download/install something else?
Title: Re: Compilation problem (undefined reference to sf::)
Post by: eXpl0it3r on April 25, 2015, 05:45:31 pm
List the source files first and then the -l flags.
Title: Re: Compilation problem (undefined reference to sf::)
Post by: Jesper Juhl on April 25, 2015, 07:05:15 pm
What eXpl0it3r is telling you is that link order matters (https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html).  ;)