Error compiling SFS login project, in C++

Post here your questions about the C++ API for SFS2X

Moderators: Lapo, Bax, MBagnati

andremlsantos
Posts: 2
Joined: 24 Mar 2018, 14:04

Error compiling SFS login project, in C++

Postby andremlsantos » 26 Mar 2018, 02:05

Hi
I'm trying to create a sample Login application in C++, using your API, that connects to my SFS back-end server.
For the process, I followed documentation mentioned in your Client Setup page, for C++, in http://docs2x.smartfoxserver.com/GettingStarted/client-api-cpp-linux-eclipse.

I successfully manage to build the SmartFoxClientApi project in eclipse, without any errors.
BUT, whenever I tried to compile the SFSX project, that connects to the API, I get several errors, that mentioned some libboost_thread.so.1.59.0 lib may be needed by the API:

Code: Select all

Building target: LoginExample
Invoking: Cross G++ Linker
g++ -L/home/andre/SmartFox/SFS2X_API_Cpp/Debug -L/home/andre/SmartFox/SFS2X_API_Cpp/Core/BoostAsio/Unix/stage/lib -o "LoginExample"  ./src/HandlerSmartFoxConnection.o ./src/LoginExample.o   -lboost_system -lpthread -lSmartFoxClientApi
/usr/bin/ld: warning: libboost_thread.so.1.59.0, needed by /home/andre/SmartFox/SFS2X_API_Cpp/Debug/libSmartFoxClientApi.so, not found (try using -rpath or -rpath-link)
makefile:45: recipe for target 'LoginExample' failed
/home/andre/SmartFox/SFS2X_API_Cpp/Debug/libSmartFoxClientApi.so: undefined reference to `boost::this_thread::hiden::sleep_until(timespec const&)'
/home/andre/SmartFox/SFS2X_API_Cpp/Debug/libSmartFoxClientApi.so: undefined reference to `boost::thread::start_thread_noexcept()'
/home/andre/SmartFox/SFS2X_API_Cpp/Debug/libSmartFoxClientApi.so: undefined reference to `boost::thread::detach()'
/home/andre/SmartFox/SFS2X_API_Cpp/Debug/libSmartFoxClientApi.so: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/home/andre/SmartFox/SFS2X_API_Cpp/Debug/libSmartFoxClientApi.so: undefined reference to `boost::thread::native_handle()'
/home/andre/SmartFox/SFS2X_API_Cpp/Debug/libSmartFoxClientApi.so: undefined reference to `boost::thread::interrupt()'
/home/andre/SmartFox/SFS2X_API_Cpp/Debug/libSmartFoxClientApi.so: undefined reference to `boost::this_thread::interruption_point()'
/home/andre/SmartFox/SFS2X_API_Cpp/Debug/libSmartFoxClientApi.so: undefined reference to `boost::detail::make_ready_at_thread_exit(boost::shared_ptr<boost::detail::shared_state_base>)'
/home/andre/SmartFox/SFS2X_API_Cpp/Debug/libSmartFoxClientApi.so: undefined reference to `vtable for boost::detail::thread_data_base'
/home/andre/SmartFox/SFS2X_API_Cpp/Debug/libSmartFoxClientApi.so: undefined reference to `boost::detail::get_current_thread_data()'
/home/andre/SmartFox/SFS2X_API_Cpp/Debug/libSmartFoxClientApi.so: undefined reference to `typeinfo for boost::detail::thread_data_base'
/home/andre/SmartFox/SFS2X_API_Cpp/Debug/libSmartFoxClientApi.so: undefined reference to `boost::thread::join_noexcept()'
/home/andre/SmartFox/SFS2X_API_Cpp/Debug/libSmartFoxClientApi.so: undefined reference to `boost::future_category()'
collect2: error: ld returned 1 exit status
make: *** [LoginExample] Error 1


In my LoginExample project, I used some code provided in your samples applications .zip (Connector project)
I did not imported the project to my workspace! I know, its only meant for windows machines. I only copied the code within and adapted for my application (class HandlerSmartFoxConnection).

I know this issue occurred in the past, so, I also followed your recommendations here http://www.smartfoxserver.com/forums/viewtopic.php?f=18&t=19759&p=85315&hilit=compile+libboost_thread and https://stackoverflow.com/questions/17512483/eclipse-mac-installation-of-boost-is-wrong-due-to-library-not-loaded-image-no, but without any luck.
Please help me, I'm trying to solve this problem for days.

Andre

My Setup:
Ubuntu 17.10, 64bits
Eclipse Oxygen.3 (4.7.3) IDE for C/C++ Developers,
SmartFoxServerX C++ API v.1.7.4

My projects
LoginExample -> connects to the API
SmartFoxClientApi -> the API

Console output
https://pastebin.com/qny4PB31
User avatar
Lapo
Site Admin
Posts: 20216
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Error compiling SFS login project, in C++

Postby Lapo » 26 Mar 2018, 07:45

Hi,
please let's keep the conversation in one place.

When these errors occur typically your linker is not configured correctly. I am not too familiar with Eclipse/C++ but all compilers work very similarly. You have a "linker path" where you provide all the paths where the dependent libraries must be found.

Make sure the linker "sees" the folder where the missing library is located.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X C++ API”

Who is online

Users browsing this forum: No registered users and 1 guest