Я новичок в использовании MongoDB c ++ в Qt.
Я уже установил Boost, драйвер MongoDB c, драйвер MongoDB c ++, а также успешно протестировал подключение БД на VS2017, следуя учебному пособию по MongoDB (https://mongodb.github.io/mongo-cxx-driver/mongocxx-v3/tutorial/).
Однако возникла большая проблема, когда я хотел применить тот же код на Qt.
Общая настройка:
- Win10
- Qt Creator v4.6.0 с
Qt v5.10.1 MSVC2017 64-bit
Компилятор Microsoft Visual C ++ 15.0
Отладчик CDB x64
- MongoDB v3.6.3
- Повышение 1.66.0 до lib64-msvc-14.1
- Mongo c драйвером v1.9.3
- Mongo cxx драйвер r3.2.0
Программа просто выходит из строя при инициализации экземпляра, как показано на следующем рисунке:
Break Down
Программа также вылетала при использовании только
$
mongocxx :: instance inst ()
C4930 было выдано предупреждение при компиляции с использованием
$
mongocxx :: instance inst ()
Я полагаю, есть две потенциальные причины моей проблемы
Ошибка связи
Неправильная версия драйвера boost / mongocxx
Ниже приведено определение в .pro файле
INCLUDEPATH += $$PWD/driver/c/include/libbson-1.0
DEPENDPATH += $$PWD/driver/c/include/libbson-1.0
LIBS += -L$$PWD/driver/c/lib -lbson-1.0
LIBS += -L$$PWD/driver/c/lib -lbson-static-1.0
INCLUDEPATH += $$PWD/driver/c/include/libmongoc-1.0
DEPENDPATH += $$PWD/driver/c/include/libmongoc-1.0
LIBS += -L$$PWD/driver/c/lib -lmongoc-1.0
LIBS += -L$$PWD/driver/c/lib -lmongoc-static-1.0
INCLUDEPATH += $$PWD/driver/c++/include/bsoncxx/v_noabi
DEPENDPATH += $$PWD/driver/c++/include/bsoncxx/v_noabi
LIBS += -L$$PWD/driver/c++/lib -lbsoncxx
INCLUDEPATH += $$PWD/driver/c++/include/mongocxx/v_noabi
DEPENDPATH += $$PWD/driver/c++/include/mongocxx/v_noabi
LIBS += -L$$PWD/driver/c++/lib -lmongocxx
INCLUDEPATH += $$PWD/driver/boost_1_66_0
DEPENDPATH += $$PWD/driver/boost_1_66_0
LIBS += -L$$PWD/driver/boost_1_66_0/lib64-msvc-14.1 \
-lboost_atomic-vc141-mt-gd-x64-1_66 \
-lboost_atomic-vc141-mt-x64-1_66 \
-lboost_bzip2-vc141-mt-gd-x64-1_66 \
-lboost_bzip2-vc141-mt-x64-1_66 \
-lboost_chrono-vc141-mt-gd-x64-1_66 \
-lboost_chrono-vc141-mt-x64-1_66 \
-lboost_container-vc141-mt-gd-x64-1_66 \
-lboost_container-vc141-mt-x64-1_66 \
-lboost_context-vc141-mt-gd-x64-1_66 \
-lboost_context-vc141-mt-x64-1_66 \
-lboost_coroutine-vc141-mt-gd-x64-1_66 \
-lboost_coroutine-vc141-mt-x64-1_66 \
-lboost_date_time-vc141-mt-gd-x64-1_66 \
-lboost_date_time-vc141-mt-x64-1_66 \
-lboost_fiber-vc141-mt-gd-x64-1_66 \
-lboost_fiber-vc141-mt-x64-1_66 \
-lboost_filesystem-vc141-mt-gd-x64-1_66 \
-lboost_filesystem-vc141-mt-x64-1_66 \
-lboost_graph-vc141-mt-gd-x64-1_66 \
-lboost_graph-vc141-mt-x64-1_66 \
-lboost_iostreams-vc141-mt-gd-x64-1_66 \
-lboost_iostreams-vc141-mt-x64-1_66 \
-lboost_locale-vc141-mt-gd-x64-1_66 \
-lboost_locale-vc141-mt-x64-1_66 \
-lboost_log-vc141-mt-gd-x64-1_66 \
-lboost_log-vc141-mt-x64-1_66 \
-lboost_log_setup-vc141-mt-gd-x64-1_66 \
-lboost_log_setup-vc141-mt-x64-1_66 \
-lboost_math_c99-vc141-mt-gd-x64-1_66 \
-lboost_math_c99-vc141-mt-x64-1_66 \
-lboost_math_c99f-vc141-mt-gd-x64-1_66 \
-lboost_math_c99f-vc141-mt-x64-1_66 \
-lboost_math_c99l-vc141-mt-gd-x64-1_66 \
-lboost_math_c99l-vc141-mt-x64-1_66 \
-lboost_math_tr1-vc141-mt-gd-x64-1_66 \
-lboost_math_tr1-vc141-mt-x64-1_66 \
-lboost_math_tr1f-vc141-mt-gd-x64-1_66 \
-lboost_math_tr1f-vc141-mt-x64-1_66 \
-lboost_math_tr1l-vc141-mt-gd-x64-1_66 \
-lboost_math_tr1l-vc141-mt-x64-1_66 \
-lboost_prg_exec_monitor-vc141-mt-gd-x64-1_66 \
-lboost_prg_exec_monitor-vc141-mt-x64-1_66 \
-lboost_program_options-vc141-mt-gd-x64-1_66 \
-lboost_program_options-vc141-mt-x64-1_66 \
-lboost_python-vc141-mt-gd-x64-1_66 \
-lboost_python-vc141-mt-x64-1_66 \
-lboost_random-vc141-mt-gd-x64-1_66 \
-lboost_random-vc141-mt-x64-1_66 \
-lboost_regex-vc141-mt-gd-x64-1_66 \
-lboost_regex-vc141-mt-x64-1_66 \
-lboost_serialization-vc141-mt-gd-x64-1_66 \
-lboost_serialization-vc141-mt-x64-1_66 \
-lboost_signals-vc141-mt-gd-x64-1_66 \
-lboost_signals-vc141-mt-x64-1_66 \
-lboost_stacktrace_noop-vc141-mt-gd-x64-1_66 \
-lboost_stacktrace_noop-vc141-mt-x64-1_66 \
-lboost_stacktrace_windbg-vc141-mt-gd-x64-1_66 \
-lboost_stacktrace_windbg-vc141-mt-x64-1_66 \
-lboost_stacktrace_windbg_cached-vc141-mt-gd-x64-1_66 \
-lboost_stacktrace_windbg_cached-vc141-mt-x64-1_66 \
-lboost_system-vc141-mt-gd-x64-1_66 \
-lboost_system-vc141-mt-x64-1_66 \
-lboost_thread-vc141-mt-gd-x64-1_66 \
-lboost_thread-vc141-mt-x64-1_66 \
-lboost_timer-vc141-mt-gd-x64-1_66 \
-lboost_timer-vc141-mt-x64-1_66 \
-lboost_type_erasure-vc141-mt-gd-x64-1_66 \
-lboost_type_erasure-vc141-mt-x64-1_66 \
-lboost_unit_test_framework-vc141-mt-gd-x64-1_66 \
-lboost_unit_test_framework-vc141-mt-x64-1_66 \
-lboost_wave-vc141-mt-gd-x64-1_66 \
-lboost_wave-vc141-mt-x64-1_66 \
-lboost_wserialization-vc141-mt-gd-x64-1_66 \
-lboost_wserialization-vc141-mt-x64-1_66 \
-lboost_zlib-vc141-mt-gd-x64-1_66 \
-lboost_zlib-vc141-mt-x64-1_66 \
-llibboost_atomic-vc141-mt-gd-x64-1_66 \
-llibboost_atomic-vc141-mt-s-x64-1_66 \
-llibboost_atomic-vc141-mt-sgd-x64-1_66 \
-llibboost_atomic-vc141-mt-x64-1_66 \
-llibboost_bzip2-vc141-mt-gd-x64-1_66 \
-llibboost_bzip2-vc141-mt-s-x64-1_66 \
-llibboost_bzip2-vc141-mt-sgd-x64-1_66 \
-llibboost_bzip2-vc141-mt-x64-1_66 \
-llibboost_chrono-vc141-mt-gd-x64-1_66 \
-llibboost_chrono-vc141-mt-s-x64-1_66 \
-llibboost_chrono-vc141-mt-sgd-x64-1_66 \
-llibboost_chrono-vc141-mt-x64-1_66 \
-llibboost_container-vc141-mt-gd-x64-1_66 \
-llibboost_container-vc141-mt-s-x64-1_66 \
-llibboost_container-vc141-mt-sgd-x64-1_66 \
-llibboost_container-vc141-mt-x64-1_66 \
-llibboost_context-vc141-mt-gd-x64-1_66 \
-llibboost_context-vc141-mt-s-x64-1_66 \
-llibboost_context-vc141-mt-sgd-x64-1_66 \
-llibboost_context-vc141-mt-x64-1_66 \
-llibboost_coroutine-vc141-mt-gd-x64-1_66 \
-llibboost_coroutine-vc141-mt-s-x64-1_66 \
-llibboost_coroutine-vc141-mt-sgd-x64-1_66 \
-llibboost_coroutine-vc141-mt-x64-1_66 \
-llibboost_date_time-vc141-mt-gd-x64-1_66 \
-llibboost_date_time-vc141-mt-s-x64-1_66 \
-llibboost_date_time-vc141-mt-sgd-x64-1_66 \
-llibboost_date_time-vc141-mt-x64-1_66 \
-llibboost_exception-vc141-mt-gd-x64-1_66 \
-llibboost_exception-vc141-mt-s-x64-1_66 \
-llibboost_exception-vc141-mt-sgd-x64-1_66 \
-llibboost_exception-vc141-mt-x64-1_66 \
-llibboost_fiber-vc141-mt-gd-x64-1_66 \
-llibboost_fiber-vc141-mt-s-x64-1_66 \
-llibboost_fiber-vc141-mt-sgd-x64-1_66 \
-llibboost_fiber-vc141-mt-x64-1_66 \
-llibboost_filesystem-vc141-mt-gd-x64-1_66 \
-llibboost_filesystem-vc141-mt-s-x64-1_66 \
-llibboost_filesystem-vc141-mt-sgd-x64-1_66 \
-llibboost_filesystem-vc141-mt-x64-1_66 \
-llibboost_graph-vc141-mt-gd-x64-1_66 \
-llibboost_graph-vc141-mt-s-x64-1_66 \
-llibboost_graph-vc141-mt-sgd-x64-1_66 \
-llibboost_graph-vc141-mt-x64-1_66 \
-llibboost_iostreams-vc141-mt-gd-x64-1_66 \
-llibboost_iostreams-vc141-mt-s-x64-1_66 \
-llibboost_iostreams-vc141-mt-sgd-x64-1_66 \
-llibboost_iostreams-vc141-mt-x64-1_66 \
-llibboost_locale-vc141-mt-gd-x64-1_66 \
-llibboost_locale-vc141-mt-s-x64-1_66 \
-llibboost_locale-vc141-mt-sgd-x64-1_66 \
-llibboost_locale-vc141-mt-x64-1_66 \
-llibboost_log-vc141-mt-gd-x64-1_66 \
-llibboost_log-vc141-mt-s-x64-1_66 \
-llibboost_log-vc141-mt-sgd-x64-1_66 \
-llibboost_log-vc141-mt-x64-1_66 \
-llibboost_log_setup-vc141-mt-gd-x64-1_66 \
-llibboost_log_setup-vc141-mt-s-x64-1_66 \
-llibboost_log_setup-vc141-mt-sgd-x64-1_66 \
-llibboost_log_setup-vc141-mt-x64-1_66 \
-llibboost_math_c99-vc141-mt-gd-x64-1_66 \
-llibboost_math_c99-vc141-mt-s-x64-1_66 \
-llibboost_math_c99-vc141-mt-sgd-x64-1_66 \
-llibboost_math_c99-vc141-mt-x64-1_66 \
-llibboost_math_c99f-vc141-mt-gd-x64-1_66 \
-llibboost_math_c99f-vc141-mt-s-x64-1_66 \
-llibboost_math_c99f-vc141-mt-sgd-x64-1_66 \
-llibboost_math_c99f-vc141-mt-x64-1_66 \
-llibboost_math_c99l-vc141-mt-gd-x64-1_66 \
-llibboost_math_c99l-vc141-mt-s-x64-1_66 \
-llibboost_math_c99l-vc141-mt-sgd-x64-1_66 \
-llibboost_math_c99l-vc141-mt-x64-1_66 \
-llibboost_math_tr1-vc141-mt-gd-x64-1_66 \
-llibboost_math_tr1-vc141-mt-s-x64-1_66 \
-llibboost_math_tr1-vc141-mt-sgd-x64-1_66 \
-llibboost_math_tr1-vc141-mt-x64-1_66 \
-llibboost_math_tr1f-vc141-mt-gd-x64-1_66 \
-llibboost_math_tr1f-vc141-mt-s-x64-1_66 \
-llibboost_math_tr1f-vc141-mt-sgd-x64-1_66 \
-llibboost_math_tr1f-vc141-mt-x64-1_66 \
-llibboost_math_tr1l-vc141-mt-gd-x64-1_66 \
-llibboost_math_tr1l-vc141-mt-s-x64-1_66 \
-llibboost_math_tr1l-vc141-mt-sgd-x64-1_66 \
-llibboost_math_tr1l-vc141-mt-x64-1_66 \
-llibboost_prg_exec_monitor-vc141-mt-gd-x64-1_66 \
-llibboost_prg_exec_monitor-vc141-mt-s-x64-1_66 \
-llibboost_prg_exec_monitor-vc141-mt-sgd-x64-1_66 \
-llibboost_prg_exec_monitor-vc141-mt-x64-1_66 \
-llibboost_program_options-vc141-mt-gd-x64-1_66 \
-llibboost_program_options-vc141-mt-s-x64-1_66 \
-llibboost_program_options-vc141-mt-sgd-x64-1_66 \
-llibboost_program_options-vc141-mt-x64-1_66 \
-llibboost_python-vc141-mt-gd-x64-1_66 \
-llibboost_python-vc141-mt-s-x64-1_66 \
-llibboost_python-vc141-mt-sgd-x64-1_66 \
-llibboost_python-vc141-mt-x64-1_66 \
-llibboost_random-vc141-mt-gd-x64-1_66 \
-llibboost_random-vc141-mt-s-x64-1_66 \
-llibboost_random-vc141-mt-sgd-x64-1_66 \
-llibboost_random-vc141-mt-x64-1_66 \
-llibboost_regex-vc141-mt-gd-x64-1_66 \
-llibboost_regex-vc141-mt-s-x64-1_66 \
-llibboost_regex-vc141-mt-sgd-x64-1_66 \
-llibboost_regex-vc141-mt-x64-1_66 \
-llibboost_serialization-vc141-mt-gd-x64-1_66 \
-llibboost_serialization-vc141-mt-s-x64-1_66 \
-llibboost_serialization-vc141-mt-sgd-x64-1_66 \
-llibboost_serialization-vc141-mt-x64-1_66 \
-llibboost_signals-vc141-mt-gd-x64-1_66 \
-llibboost_signals-vc141-mt-s-x64-1_66 \
-llibboost_signals-vc141-mt-sgd-x64-1_66 \
-llibboost_signals-vc141-mt-x64-1_66 \
-llibboost_stacktrace_noop-vc141-mt-gd-x64-1_66 \
-llibboost_stacktrace_noop-vc141-mt-s-x64-1_66 \
-llibboost_stacktrace_noop-vc141-mt-sgd-x64-1_66 \
-llibboost_stacktrace_noop-vc141-mt-x64-1_66 \
-llibboost_stacktrace_windbg-vc141-mt-gd-x64-1_66 \
-llibboost_stacktrace_windbg-vc141-mt-s-x64-1_66 \
-llibboost_stacktrace_windbg-vc141-mt-sgd-x64-1_66 \
-llibboost_stacktrace_windbg-vc141-mt-x64-1_66 \
-llibboost_stacktrace_windbg_cached-vc141-mt-gd-x64-1_66 \
-llibboost_stacktrace_windbg_cached-vc141-mt-s-x64-1_66 \
-llibboost_stacktrace_windbg_cached-vc141-mt-sgd-x64-1_66 \
-llibboost_stacktrace_windbg_cached-vc141-mt-x64-1_66 \
-llibboost_system-vc141-mt-gd-x64-1_66 \
-llibboost_system-vc141-mt-s-x64-1_66 \
-llibboost_system-vc141-mt-sgd-x64-1_66 \
-llibboost_system-vc141-mt-x64-1_66 \
-llibboost_test_exec_monitor-vc141-mt-gd-x64-1_66 \
-llibboost_test_exec_monitor-vc141-mt-s-x64-1_66 \
-llibboost_test_exec_monitor-vc141-mt-sgd-x64-1_66 \
-llibboost_test_exec_monitor-vc141-mt-x64-1_66 \
-llibboost_thread-vc141-mt-gd-x64-1_66 \
-llibboost_thread-vc141-mt-s-x64-1_66 \
-llibboost_thread-vc141-mt-sgd-x64-1_66 \
-llibboost_thread-vc141-mt-x64-1_66 \
-llibboost_timer-vc141-mt-gd-x64-1_66 \
-llibboost_timer-vc141-mt-s-x64-1_66 \
-llibboost_timer-vc141-mt-sgd-x64-1_66 \
-llibboost_timer-vc141-mt-x64-1_66 \
-llibboost_type_erasure-vc141-mt-gd-x64-1_66 \
-llibboost_type_erasure-vc141-mt-s-x64-1_66 \
-llibboost_type_erasure-vc141-mt-sgd-x64-1_66 \
-llibboost_type_erasure-vc141-mt-x64-1_66 \
-llibboost_unit_test_framework-vc141-mt-gd-x64-1_66 \
-llibboost_unit_test_framework-vc141-mt-s-x64-1_66 \
-llibboost_unit_test_framework-vc141-mt-sgd-x64-1_66 \
-llibboost_unit_test_framework-vc141-mt-x64-1_66 \
-llibboost_wave-vc141-mt-gd-x64-1_66 \
-llibboost_wave-vc141-mt-s-x64-1_66 \
-llibboost_wave-vc141-mt-sgd-x64-1_66 \
-llibboost_wave-vc141-mt-x64-1_66 \
-llibboost_wserialization-vc141-mt-gd-x64-1_66 \
-llibboost_wserialization-vc141-mt-s-x64-1_66 \
-llibboost_wserialization-vc141-mt-sgd-x64-1_66 \
-llibboost_wserialization-vc141-mt-x64-1_66 \
-llibboost_zlib-vc141-mt-gd-x64-1_66 \
-llibboost_zlib-vc141-mt-s-x64-1_66 \
-llibboost_zlib-vc141-mt-sgd-x64-1_66 \
-llibboost_zlib-vc141-mt-x64-1_66
Есть ли ошибка при подключении драйвера?
Или используемая мной версия драйвера неверна (но это нормально при использовании VS2017)
Кто-нибудь сталкивался с такой же проблемой?
ТКС