I am trying to connect MongoDb with Qt c++. When I build it there is no error, just information like;
:-1: warning: libboost_system.so.1.54.0, needed by /usr/local/lib/libboost_thread.so, may conflict with libboost_system.so.5
However when I tried to Run it says:
error while loading shared libraries: libboost_thread.so.1.54.0: cannot open shared object file: No such file or directory
Here is my small code sample which everything looks fine.
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <mongo/client/dbclient.h>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
try
{
mongo::DBClientConnection c;
c.connect("localhost");
qDebug() << "Connected to Mongo";
}
catch (mongo::DBException &e)
{
qDebug() << "Cannot, Error : " << e.what();
}
}
MainWindow::~MainWindow()
{
delete ui;
}
Could you please help me why I am getting this error and how to fix it ?
EDIT :
Here is also my .pro file ;
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = mongodbtest
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
INCLUDEPATH += /usr/local/lib/
LIBS += -pthread \
-lmongoclient \
-lboost_thread \
-lboost_system \
-lboost_regex
and I see that I already have libboost_thread.so.1.54.0
[mg@mg-CentOS mg]$ locate libboost_thread.so.1.54.0 /usr/local/lib/libboost_thread.so.1.54.0
INCLUDE_PATH
didnt solve my problem too. – goGud