私は C ドライバーを作成していませんが、Qt Creator で C++ ドライバーを作成中です。プロジェクトにブースト ライブラリを含める必要があります。また、ダウンロードした MongoDB クライアント C++ のバージョンの場合、Boost 1.49 ライブラリである必要があり、それ以上でもそれ以下でもありません。これをダウンロードして、すべてのライブラリをビルドするだけです。ただし、これには約 4 つのライブラリしか必要ありません。以下は、私の Qt Creator .pro ファイルからの関連コードです。私の C:/MongoDB フォルダー内のすべてが MongoDB ソースからダウンロードされているか、少なくともその直接ダウンロードから scons によってビルドされていることに注意してください。
INCLUDEPATH += C:/MongoDB/src \
C:/MongoDB/src/mongo/client \
C:/MongoDB/src/third_party/boost \
C:/MongoDB/src/third_party/boost/boost \
C:/MongoDB/src/mongo \
C:/MongoDB/src/third_party/boost/boost/algorithm \
C:/MongoDB/src/third_party/boost/boost/asio \
C:/MongoDB/src/third_party/boost/boost/bind \
C:/MongoDB/src/third_party/boost/boost/concept \
C:/MongoDB/src/third_party/boost/boost/config \
C:/MongoDB/src/third_party/boost/boost/container \
C:/MongoDB/src/third_party/boost/boost/date_time \
C:/MongoDB/src/third_party/boost/boost/detail \
C:/MongoDB/src/third_party/boost/boost/exception \
C:/MongoDB/src/third_party/boost/boost/filesystem \
C:/MongoDB/src/third_party/boost/boost/function \
C:/MongoDB/src/third_party/boost/boost/functional \
C:/MongoDB/src/third_party/boost/boost/integer \
C:/MongoDB/src/third_party/boost/boost/io \
C:/MongoDB/src/third_party/boost/boost/iterator \
C:/MongoDB/src/third_party/boost/boost/math \
C:/MongoDB/src/third_party/boost/boost/move \
C:/MongoDB/src/third_party/boost/boost/mpl \
C:/MongoDB/src/third_party/boost/boost/numeric \
C:/MongoDB/src/third_party/boost/boost/optional \
C:/MongoDB/src/third_party/boost/boost/pending \
C:/MongoDB/src/third_party/boost/boost/preprocessor \
C:/MongoDB/src/third_party/boost/boost/program_options\
C:/MongoDB/src/third_party/boost/boost/random \
C:/MongoDB/src/third_party/boost/boost/range \
C:/MongoDB/src/third_party/boost/boost/regex \
C:/MongoDB/src/third_party/boost/boost/smart_ptr \
C:/MongoDB/src/third_party/boost/boost/spirit \
C:/MongoDB/src/third_party/boost/boost/system \
C:/MongoDB/src/third_party/boost/boost/test \
C:/MongoDB/src/third_party/boost/boost/thread \
C:/MongoDB/src/third_party/boost/boost/tuple \
C:/MongoDB/src/third_party/boost/boost/type_traits \
C:/MongoDB/src/third_party/boost/boost/typeof \
C:/MongoDB/src/third_party/boost/boost/units \
C:/MongoDB/src/third_party/boost/boost/unordered \
C:/MongoDB/src/third_party/boost/boost/utility \
DEFINES += _UNICODE \
SYM_STATICLIB
QMAKE_CFLAGS_RELEASE += /MT
QMAKE_CXXFLAGS_RELEASE += /MT
QMAKE_CFLAGS_DEBUG += /MTd
QMAKE_CXXFLAGS_DEBUG += /MTd
LIBS += -L$$PWD/../../../../../../MongoDB/src/third_party -lWS2_32
LIBS += -L$$PWD/../../../../../../MongoDB/src/third_party -lDbgHelp
CONFIG(debug, debug|release) {
LIBS += -LC:\MongoDB\build\win32\debug\client_build -lmongoclient
LIBS += -L$$PWD/../../../../../../Boost/1.49/bin.v2/libs/thread/build/msvc-10.0/debug/link-static/runtime-link-static/threading-multi/ -llibboost_thread-vc100-mt-sgd-1_49
LIBS += -L$$PWD/../../../../../../Boost/1.49/bin.v2/libs/date_time/build/msvc-10.0/debug/link-static/runtime-link-static/threading-multi/ -llibboost_date_time-vc100-mt-sgd-1_49
LIBS += -L$$PWD/../../../../../../Boost/1.49/bin.v2/libs/system/build/msvc-10.0/debug/link-static/runtime-link-static/ -llibboost_system-vc100-sgd-1_49
LIBS += -L$$PWD/../../../../../../Boost/1.49/bin.v2/libs/filesystem/build/msvc-10.0/debug/link-static/runtime-link-static/ -llibboost_filesystem-vc100-sgd-1_49
}
CONFIG(release, debug|release) {
LIBS += -LC:\MongoDB\build\win32\release\client_build -lmongoclient
LIBS += -L$$PWD/../../../../../../Boost/1.49/bin.v2/libs/thread/build/msvc-10.0/release/link-static/runtime-link-static/threading-multi/ -llibboost_thread-vc100-mt-s-1_49
LIBS += -L$$PWD/../../../../../../Boost/1.49/bin.v2/libs/date_time/build/msvc-10.0/release/link-static/runtime-link-static/threading-multi/ -llibboost_date_time-vc100-mt-s-1_49
LIBS += -L$$PWD/../../../../../../Boost/1.49/bin.v2/libs/system/build/msvc-10.0/release/link-static/runtime-link-static/ -llibboost_system-vc100-s-1_49
LIBS += -L$$PWD/../../../../../../Boost/1.49/bin.v2/libs/filesystem/build/msvc-10.0/release/link-static/runtime-link-static/ -llibboost_filesystem-vc100-s-1_49
}
Qt は、静的 C++ ランタイムに対してビルドすると誤動作することが知られているため、ここで与えられたアドバイスに従い、静的ランタイムに対してビルドされた Qt 以外の C++ dll でドライバーをラップし、その dll を内部で使用するのがおそらく最善の方法です。動的ランタイムに対して構築されるメインの Qt アプリ。
また、winsock とヘルプ ライブラリをルート フォルダーに手動でコピーし、それらを手動で含める必要があったことにも注意してください。これは、スペースが含まれているために Qt Creator が「Program Files (x86)」パスを受け入れないためです。
これは「Mongo C」の回答ではないことは承知していますが、C++ドライバーを機能させることに不満を感じてCドライバーのみを使用していると述べたので、私が知っていることを共有したいと思いました。