SFML community forums

Help => General => Topic started by: paupav on February 03, 2016, 10:39:29 pm

Title: sfml with gcc 5.2
Post by: paupav on February 03, 2016, 10:39:29 pm
compile it and put on the website plox
I'm getting error message:   undefined reference to `sf::Texture::loadFromFile(std::string const&, sf::Rect<int> const&)'|
Title: Re: sfml with gcc 5.2
Post by: Hapax on February 03, 2016, 10:44:46 pm
This is not a "general discussion"; this is a help request and should be posted in the help forums.
You should know this. You've posted there a lot!

Make sure you're linking the libraries.
Title: sfml with gcc 5.2
Post by: eXpl0it3r on February 03, 2016, 11:00:17 pm
Just build SFML from source, it's not that complicated.
Title: Re: sfml with gcc 5.2
Post by: paupav on February 04, 2016, 02:56:50 pm
It is still not working, even after compiling it. I still have the same error message undefined reference to `sf::Font::loadFromFile(std::string const&)'|
and similar errors:
(click to show/hide)

Make log:
(click to show/hide)
Code is correct and libraries are correctly linked.
Code: https://github.com/paupav/boxGame
Title: Re: sfml with gcc 5.2
Post by: dabbertorres on February 05, 2016, 04:06:18 am
You're probably not linking to the newly created libraries.

You're not showing your compile/link commands.

Also, why are you using gcc 5.2? 5.3 fixes bugs in 5.2.
Title: Re: sfml with gcc 5.2
Post by: paupav on February 05, 2016, 09:41:57 am
That's the version in the Ubuntu 15.10
Title: Re: sfml with gcc 5.2
Post by: eXpl0it3r on February 05, 2016, 01:50:11 pm
My guess would be that you're not linking against sfml-system or not in the correct order. Can you provide the full build command?
Title: Re: sfml with gcc 5.2
Post by: paupav on February 05, 2016, 03:42:35 pm
I'm usually using CodeBlocks

EDIT: it seems that I just have to define const strings instead of just writing in file names.
e.g
const std::string menuFS = "menu.ttf";
font.loadFromFile(menuFS);

instead of:
font.loadFromFile("menu.ttf");
Title: Re: sfml with gcc 5.2
Post by: eXpl0it3r on February 05, 2016, 04:06:54 pm
sfml-network also depends on sfml-system so you'd have to move sfml-system one position down, however that has nothing to do with the error.

You can still extract the verbose build command (http://www.sfml-dev.org/faq.php#tr-grl-verbose-ide) from Code::Blocks.
Title: Re: sfml with gcc 5.2
Post by: paupav on February 05, 2016, 04:37:53 pm
It is working now for some reason. I've just updated Ubuntu and I've put sfml-network above sfml-system in linker settings.