Issues with linking TGUI

Started by TheP4R4D0X, 05 April 2019, 23:25:59


So finally got SFML working now trying to get TGUI working.
Linux Mint - 19.1, 64-bit.
SFML: 2.5.1
TGUI: 0.8.4
g++ compiler, cmake and make - all up-to-date.

I tried installing TGUI from the PPA - however, it kept giving me warnings that it was trying to use an older version of SFML (2.4.1) which got installed as a requirement - however, I wanted to use the "latest" stuff (may or may not be a requirement - BUT I would prefer it).

I downloaded the source of both SFML and TGUI - successfully built both of them (to ensure they work together and with compiler).
now trying to create a project and having issues with an sf::String::operator.

I am using CMakeLists.txt to generate the project (just started to learn the basics for cmake): follows:
cmake_minimum_required(VERSION 3.10.2)

include_directories(../includes includes includes/gameManagement)

file(GLOB SOURCES "src/*.cpp" "src/gameManagement/*.cpp")

set(SFML_DIR "../Base/SFML-2.5.1/lib/cmake/SFML")
set(TGUI_DIR "../Base/TGUI-0.8.4")

find_package(SFML 2.5.1 COMPONENTS system window graphics REQUIRED)
find_package(TGUI 0.8.4 REQUIRED)
add_executable(EXEC_NAME ${SOURCES})
target_link_libraries(EXEC_NAME sfml-system sfml-window sfml-graphics tgui)

the output I get is:
-- Found SFML 2.5.1 in /home/USER/Desktop/SFML/Base/SFML-2.5.1/lib/cmake/SFML
-- Found TGUI 0.8.4 in /home/USER/Desktop/SFML/Base/TGUI-0.8.4
-- Configuring done
-- Generating done
-- Build files have been written to: /home/USER/Desktop/SFML/PROJECTNAME/build
Scanning dependencies of target EXEC_NAME
[ 25%] Building CXX object CMakeFiles/EXEC_NAME.dir/src/main.cpp.o
[ 50%] Building CXX object CMakeFiles/EXEC_NAME.dir/src/gameManagement/Engine.cpp.o
[ 75%] Building CXX object CMakeFiles/EXEC_NAME.dir/src/gameManagement/UserSettings.cpp.o
[100%] Linking CXX executable EXEC_NAME
/home/USER/Desktop/SFML/Base/TGUI-0.8.4/lib/ 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
CMakeFiles/EXEC_NAME.dir/build.make:150: recipe for target 'EXEC_NAME' failed
make[2]: *** [EXEC_NAME] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/EXEC_NAME.dir/all' failed
make[1]: *** [CMakeFiles/EXEC_NAME.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
mv: cannot stat 'EXEC_NAME': No such file or directory
./EXEC_NAME: error while loading shared libraries: cannot open shared object file: No such file or directory

TLDR: /home/USER/Desktop/SFML/Base/TGUI-0.8.4/lib/ undefined reference to `sf::String::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >() const'
Is what is giving me the issue... I saw someone else had this issue
However, that is not helpful for the current version. If all else fails - yes I can just download the versions of SFML and TGUI as found in the package manager >_>...



Feel like an idiot now...

I will leave this here encase anyone else is having the same issues...
I ran the build - figured I got the libraries that is all I need... I mean yes, BUT would need to change alot of system vars...
(Yes this was in the tutorial but I overlooked it...)

After you build SFML and TGUI - you need to go to the file that you built into (i.e. SFMLBuild) and run the following command:
'make install'
if that does not work try 'sudo make install' - depending on your linux distribution.

Problem solved...