'Why cannot linking -lboost_system it just dont work
Tried to build start WT project in QT Creator with qmake. Had linking error with -lboost_system, it just didnt work.
Errors:
x86_64-linux-gnu-g++ -o Kursach main.o -lwt -lwthttp
-lboost_program_options -lboost_thread -lboost_filesystem -lboost_system -L/usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/libQt5Core.so -lpthread /usr/bin/ld:
warning: libboost_thread.so.1.58.0, needed by /usr/local/lib/libwt.so,
not found (try using -rpath or -rpath-link) /usr/bin/ld: warning:
libboost_system.so.1.58.0, needed by /usr/local/lib/libwt.so, not
found (try using -rpath or -rpath-link) /usr/bin/ld: warning:
libboost_filesystem.so.1.58.0, needed by /usr/local/lib/libwt.so, not
found (try using -rpath or -rpath-link) /usr/bin/ld: warning:
libboost_program_options.so.1.58.0, needed by
/usr/local/lib/libwthttp.so, not found (try using -rpath or
-rpath-link) /usr/bin/ld: /usr/local/lib/libwt.so: undefined reference to `boost::system::system_category()' /usr/bin/ld:
/usr/local/lib/libwt.so: undefined reference to
`boost::system::generic_category()' /usr/bin/ld:
/usr/local/lib/libwt.so: undefined reference to
`boost::detail::set_tss_data(void const*,
boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)'
collect2: error: ld returned 1 exit status make: *** [Makefile:141:
Kursach] Error 1 16:29:43: The process "/usr/bin/make" exited with
code 2. Error while building/deploying project Kursach (kit: Desktop)
When executing step "Make"
.pro file:
QT += core
QT -= gui
CONFIG += c++17
#INCLUDEPATH += /usr/include/boost/
LIBS += -lwt -lwthttp \
-lboost_program_options -lboost_thread -lboost_filesystem -lboost_system \
-L/usr/lib/x86_64-linux-gnu
QMAKE_CXXFLAGS += -DNDEBUG
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
main.cpp
#include <Wt/WApplication.h>
#include <Wt/WBreak.h>
#include <Wt/WContainerWidget.h>
#include <Wt/WLineEdit.h>
#include <Wt/WPushButton.h>
#include <Wt/WText.h>
class HelloApplication : public Wt::WApplication
{
public:
HelloApplication(const Wt::WEnvironment& env);
private:
Wt::WLineEdit *nameEdit_;
Wt::WText *greeting_;
};
HelloApplication::HelloApplication(const Wt::WEnvironment& env)
: Wt::WApplication(env)
{
setTitle("Hello world");
root()->addWidget(std::make_unique<Wt::WText>("Your name, please? "));
nameEdit_ = root()->addWidget(std::make_unique<Wt::WLineEdit>());
Wt::WPushButton *button = root()->addWidget(std::make_unique<Wt::WPushButton>("Greet me."));
root()->addWidget(std::make_unique<Wt::WBreak>());
greeting_ = root()->addWidget(std::make_unique<Wt::WText>());
auto greet = [this]{
greeting_->setText("Hello there, " + nameEdit_->text());
};
button->clicked().connect(greet);
}
int main(int argc, char **argv)
{
return Wt::WRun(argc, argv, [](const Wt::WEnvironment& env) {
return std::make_unique<HelloApplication>(env);
});
}
Solution 1:[1]
Downloading and installing old version of boost (1.58) was useful, now all is working ok.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Albion st |
