Hello,
I could successfully compile the C++ api.
I tried to create a basic application (only contains one hello world program) and defined the dependencies. I am getting a compilation error :
00:25:43 **** Incremental Build of configuration Debug for project Sample ****
make all
Building target: Sample
Invoking: Cross G++ Linker
g++ -L/opt/SmartFoxServer_2X/SFS2X_API_Cpp_v1.7.3/Debug -L/opt/SmartFoxServer_2X/SFS2X_API_Cpp_v1.7.3/Core/BoostAsio/Unix/stage/lib -o "Sample" ./src/Sample.o -lboost_system -lpthread -lSmartFoxClientApi
/usr/bin/ld: warning: libboost_thread.so.1.59.0, needed by /opt/SmartFoxServer_2X/SFS2X_API_Cpp_v1.7.3/Debug/libSmartFoxClientApi.so, not found (try using -rpath or -rpath-link)
makefile:45: recipe for target 'Sample' failed
/opt/SmartFoxServer_2X/SFS2X_API_Cpp_v1.7.3/Debug/libSmartFoxClientApi.so: undefined reference to `boost::this_thread::hiden::sleep_until(timespec const&)'
/opt/SmartFoxServer_2X/SFS2X_API_Cpp_v1.7.3/Debug/libSmartFoxClientApi.so: undefined reference to `boost::thread::start_thread_noexcept()'
/opt/SmartFoxServer_2X/SFS2X_API_Cpp_v1.7.3/Debug/libSmartFoxClientApi.so: undefined reference to `boost::thread::detach()'
/opt/SmartFoxServer_2X/SFS2X_API_Cpp_v1.7.3/Debug/libSmartFoxClientApi.so: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/opt/SmartFoxServer_2X/SFS2X_API_Cpp_v1.7.3/Debug/libSmartFoxClientApi.so: undefined reference to `boost::thread::native_handle()'
/opt/SmartFoxServer_2X/SFS2X_API_Cpp_v1.7.3/Debug/libSmartFoxClientApi.so: undefined reference to `boost::thread::interrupt()'
/opt/SmartFoxServer_2X/SFS2X_API_Cpp_v1.7.3/Debug/libSmartFoxClientApi.so: undefined reference to `boost::this_thread::interruption_point()'
/opt/SmartFoxServer_2X/SFS2X_API_Cpp_v1.7.3/Debug/libSmartFoxClientApi.so: undefined reference to `boost::detail::make_ready_at_thread_exit(boost::shared_ptr<boost::detail::shared_state_base>)'
/opt/SmartFoxServer_2X/SFS2X_API_Cpp_v1.7.3/Debug/libSmartFoxClientApi.so: undefined reference to `vtable for boost::detail::thread_data_base'
/opt/SmartFoxServer_2X/SFS2X_API_Cpp_v1.7.3/Debug/libSmartFoxClientApi.so: undefined reference to `boost::detail::get_current_thread_data()'
/opt/SmartFoxServer_2X/SFS2X_API_Cpp_v1.7.3/Debug/libSmartFoxClientApi.so: undefined reference to `typeinfo for boost::detail::thread_data_base'
/opt/SmartFoxServer_2X/SFS2X_API_Cpp_v1.7.3/Debug/libSmartFoxClientApi.so: undefined reference to `boost::thread::join_noexcept()'
/opt/SmartFoxServer_2X/SFS2X_API_Cpp_v1.7.3/Debug/libSmartFoxClientApi.so: undefined reference to `boost::future_category()'
collect2: error: ld returned 1 exit status
make: *** [Sample] Error 1
00:25:43 Build Finished (took 285ms)
OS : Debian 8
api version : 1.7.3
eclipse Version: Neon.3 Release (4.6.3)
Any help would be appreciated.
Thank you.
Error while compiling C++ API and Sample Application
Re: Error while compiling C++ API and Sample Application
Hi,
I think you're missing a reference to the boost thread lib, as per the error message:
I am not very familiar with C++ development in Ubuntu but it looks like you need to add -lboost_thread to the compiler command
Hope it helps
I think you're missing a reference to the boost thread lib, as per the error message:
/usr/bin/ld: warning: libboost_thread.so.1.59.0, needed by
I am not very familiar with C++ development in Ubuntu but it looks like you need to add -lboost_thread to the compiler command
Hope it helps
Re: Error while compiling C++ API and Sample Application
Are you sure that your linker sees the folder where the library is located?
That usually fixes the issue.
Cheers
That usually fixes the issue.
Cheers
Who is online
Users browsing this forum: No registered users and 46 guests