issues in Mongodb driver with Qt creator
-
Hi, iam facing a issue in linking Mongodb driver with qt creator . i have gone through some of the forum but nothing helps .
its saying no file found . its a linking error . iam a beginner following are the procedure i did
1 - build and installed mongodb c &cxx driver with MinGW64
2- my qt creator version is Qt 5.11.2 (MSVC 2015, 32 bit)
3 -compiler MinGW 5.3.0 32bit
is the compiler 32bit makes any problem or linking commad problem in pro file???? please help
-
@Vivek_A said in issues in Mongodb driver with Qt creator:
my qt creator version is Qt 5.11.2
QtCreator version does not matter. QtCreator is just an IDE.
What matters is Qt version.
Did you use exact same compiler to build Mongodb driver as you use to build your app?
How do you use the Mongodb driver? Please show your pro file. -
@jsulm .pro file contain
#-------------------------------------------------Project created by QtCreator 2014-02-04T17:25:51
#-------------------------------------------------
cache()QT += core gui network widgets xml serialport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgetsTEMPLATE = app
TARGET = RTLSController
QMAKE_INFO_PLIST = Info.plist
RC_ICONS = res/DWctrler.icoINCLUDEPATH += graphics models network views util tools
QMAKE_LFLAGS+=-Wl,-Map=mapfile
SOURCES +=
main.cpp
models/DataLink.cpp
models/datamodel.cpp
models/DataRoot.cpp
models/ViewSettings.cpp
mongocxx/events/command_failed_event.cpp
mongocxx/events/command_started_event.cpp
mongocxx/events/command_succeeded_event.cpp
mongocxx/events/heartbeat_failed_event.cpp
mongocxx/events/heartbeat_started_event.cpp
mongocxx/events/heartbeat_succeeded_event.cpp
mongocxx/events/server_changed_event.cpp
mongocxx/events/server_closed_event.cpp
mongocxx/events/server_description.cpp
mongocxx/events/server_opening_event.cpp
mongocxx/events/topology_changed_event.cpp
mongocxx/events/topology_closed_event.cpp
mongocxx/events/topology_description.cpp
.............................
..........................
.............................HEADERS +=
RTLSControllerApplication.h
views/mainwindow.h
views/anchorlistwidget.h
views/anchorpropertieswidget.h
views/GraphicsWidget.h
views/connectionwidget.h
views/GraphicsView.h
models/datamodel.h
models/DataRoot.h
models/ViewSettings.h
mongocxx/config/private/postlude.hh
mongocxx/config/private/prelude.hh
..............
.............................
................
RESOURCES +=
res/resources.qrc
LIBS += “C:\mongo-cxx-driver\lib\mongoc-1.0.lib”
INCLUDEPATH += “C:\mongo-cxx-driver\include\libmongoc-1.0”LIBS += “C:\mongo-cxx-driver\lib\bson-1.0.lib”
INCLUDEPATH += “C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx” -
@Vivek_A said in issues in Mongodb driver with Qt creator:
LIBS += “C:\mongo-cxx-driver\lib\mongoc-1.0.lib”
INCLUDEPATH += “C:\mongo-cxx-driver\include\libmongoc-1.0”
LIBS += “C:\mongo-cxx-driver\lib\bson-1.0.lib”
INCLUDEPATH += “C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx”Change \ to / and do a complete rebuild.
Also, please post the error message you get, it is not clear which lib exactly is not found. -
@jsulm edited
LIBS += “/c/mongo-cxx-driver/lib/mongoc-1.0.lib” INCLUDEPATH += “/c/mongo-cxx-driver/include/mongocxx/v_noabi/mongocxx” LIBS += “/c/mongo-cxx-driver/lib/bson-1.0.lib” INCLUDEPATH += “/c/mongo-cxx-driver/include/bsoncxx/v_noabi/bsoncxx” Rebuilded error
mingw32-make[1]: *** No rule to make target 'mongocxx/events/command_failed_event.cpp', needed by 'release/command_failed_event.o'. Stop.
mingw32-make[1]: Leaving directory 'E:/RTLS/build-dw_controller-Desktop_Qt_5_11_2_MinGW_32bit-Release'
Makefile:36: recipe for target 'release' failed
mingw32-make: *** [release] Error 2
15:03:32: The process "C:\Qt\Qt5.11.2\Tools\mingw530_32\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project dw_controller (kit: Desktop Qt 5.11.2 MinGW 32bit)
When executing step "Make"
15:03:32: Elapsed time: 01:35. -
@Vivek_A said in issues in Mongodb driver with Qt creator:
mongocxx/events/command_failed_event.cpp
Isn't this part of Mongo cxx driver?
-
@jsulm sorry for that , i removed some includes .now the error is
g++: error: “\c\mongo-cxx-driver\lib\mongoc-1.0.libâ€: No such file or directory g++: error: “\c\mongo-cxx-driver\lib\bson-1.0.libâ€: No such file or directory.
i know its not there, in my case in mongodb lib folder there is no .lib file , in above screenshot showing that there is .A file , so how to fix that.
-
Hi,
@Vivek_A said in issues in Mongodb driver with Qt creator:
mongoc-1.0.libâ€: No such file or directory
You have some strange maybe invisible char(s) in your file.
Remove them -
@SGaist & @jsulm ok, i tried linking lib by this link https://doc.qt.io/qtcreator/creator-project-qmake-libraries.html.
after clicking and setting as external library
linking code came in pro file like thiswin32:CONFIG(release, debug|release): LIBS += -LC:/mongo-cxx-driver/lib/ -llibmongocxx.dll else:win32:CONFIG(debug, debug|release): LIBS += -LC:/mongo-cxx-driver/lib/ -llibmongocxx.dlld INCLUDEPATH += C:/mongo-cxx-driver/include DEPENDPATH += C:/mongo-cxx-driver/include
after that i added ```
#include <mongocxx/client.hpp>in main.cpp but error coming no such file or directory...please check...!!!
-
Where is
client.hpp
located exactly on your disc ? -
@SGaist @jsulm
my compiler is mingw32bit and mongocxx driver build in 64 bit . so thats make problem , i solved it by installing 64bit Qt.
Then i started coding i have added all heders and
the created application of pushbutton ,. when push button clicked mongodb will insrt data . but when i building and run the app , its closing down.12:49:58: Starting C:\Users\LD-RD2\Documents\build-mongo2-Desktop_Qt_6_1_2_MinGW_64_bit-Debug\debug\mongo2.exe ... 12:50:02: The program has unexpectedly finished. 12:50:02: The process was ended forcefully.
issues
:-1: warning: An exception was triggered: Exception at 0x7ffa8d37d1a0, code: 0xc0000135: DLL not found, flags=0x0.
i tested with removing all other mongodb codes and teated with only one statement mongocxx::instance inst; but still same problem.... Any idea???
-
Can the MongoDB dlls be found at run time ?