undefined reference to `sf::String::operator

Started by Saran, 18 June 2017, 10:42:50

Saran

Hello, I have problem running example TGUI app.

Error:

/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../lib/libtgui.so: undefined reference to `sf::String::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >() const'
collect2: error: ld returned 1 exit status

I use g++ main.cpp -lsfml-graphics -lsfml-window -lsfml-system -ltgui -o test

texus

Did you just install SFML and TGUI or were they installed earlier and did you update your compiler since then?
Based on the error I would guess the latter and I would suggest compiling TGUI again.

Saran

I installed sfml and tgui using pacman/yaourt, they weren't preinstalled.

texus

That error shouldn't happen when you install TGUI from yaourt unless something happened afterwards.
If you e.g. do a system update with pacman then the gcc or SFML version may change and the TGUI libraries that you have installed may no longer be compatible (as they were installed with yaourt and thus not updated with the other packages).

So you should try removing TGUI and reinstalling it (with yaourt) and see if that fixes the issue.

Saran

Nothing happened :(
After reinstalling still the same error.

texus

#5
Maybe there is some inconsistency with the compiler used to build the sfml and tgui libraries. You could try building SFML from source as well (by installing "sfml-git" from the AUR instead of the "sfml" package).

Edit: I just reproduced it here, using "sfml-git" instead of "sfml" solves the issue.

Saran

Thanks for help :)
"sfml" from pacman is version 2.4.2, and "sfml-git" is 2.4.0.
It works.

texus

#7
Quote"sfml" from pacman is version 2.4.2, and "sfml-git" is 2.4.0.
This is not correct. The sfml-git package (just like tgui-git) always builds the latest version, sfml-git is thus newer than sfml 2.4.2. The version number displayed on the AUR is confusingly the version of the last update to the PKGBUILD script. For instance, tgui-git used to still show version 0.7-alpha2 while it was already building tgui 0.7.3. But any package with "-git" at the end should build the very latest version, no matter what the version number on the AUR says.