c++ - QT, socket.io and boost integration undefined references errors -
i'm new boost , starter qt, i'm unaware how packaging system works in qt, boost , cpp well.
i'm trying integrate socket.io
using boost
in qt following this tutorial. i'm trying without cmake because looked more understandable me. errors , warnings i'm receiving in picture:
all i've done far this:
-downloaded , unpacked boost
-commands history:
254 ./bootstrap.sh 255 ./b2 --help 256 ./b2 257 ./bjam install --prefix="./" --with-system --with-date_time --with-random link=static runtime-link=shared threading=multi 258 git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git
-copied content of src
folder in github repo project under folder name siosrc
-updated pro
file , content:
template = app qt += qml quick widgets config += c++11 sources += main.cpp \ siosrc/sio_client.cpp \ siosrc/sio_socket.cpp \ siosrc/internal/sio_client_impl.cpp \ siosrc/internal/sio_packet.cpp resources += qml.qrc # additional import path used resolve qml modules in qt creator's code model qml_import_path = # default rules deployment. include(deployment.pri) includepath += /home/akash/softwares/boost/boost_1_61_0/include/ \ /home/akash/qtprojects/siocpp/socket.io-client-cpp/lib/websocketpp/ \ /home/akash/qtprojects/siocpp/socket.io-client-cpp/lib/rapidjson/include/ \ /home/akash/softwares/boost/boost_1_61_0/lib/
all steps i've performed figure out github readme , socket.io's cpp blog, seems outdated me since location of source file sio_packet.cpp
isn't correct respect file's location in github repo.
i hope i've been descriptive enough , can me out!
your build not linking boost::system
.
assuming you've built boost
linux
according instructions here (i.e. directory @ $boost_root
environment variable) can add boost
library directory pro
file, followed boost_system
lib file:
# ensure boost_root environment variable has been set boost_root = $$(boost_root) isempty(boost_root) { error("please set boost_root location of boost libraries") } else { message(using boost from: $$boost_root) } libs += -l$${boost_root}/stage/lib libs += -lboost_system
note: there packaged boost
libraries linux
installed @ /usr/lib
, /usr/lib64
, /usr/local/lib
, etc , don't require path defined.
i use number of boost
libraries , find easier list required libraries , use loop in pro
file add link dependencies, e.g.:
boost_libs = system log_setup log program_options thread libs += -l$${boost_root}/stage/lib boost_lib_prefix = boost_ for(lib, boost_libs) { message(link: $${boost_lib_prefix}$${lib}) libs += -l$${boost_lib_prefix}$${lib}} }
Comments
Post a Comment