我正在尝试遵循本指南,目前处于第 3 步。
所以跑完之后,
curl -OL https://github.com/mongodb/mongo-cxx-driver/archive/r3.0.1.tar.gz
tar -xzf r3.0.1.tar.gz
cd mongo-cxx-driver-r3.0.1/
我尝试执行与mongoc 的 Windows 指南中类似的命令:
如果我只是
cmake -G "Visual Studio 14 2015 Win64" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=C:/mongo-cxx-driver"
我收到一个错误
CMake Error at cmake/FindLibBSON.cmake:37 (message):
Don't know how to find libbson; please set LIBBSON_DIR to the prefix
directory with which libbson was configured.
Call Stack (most recent call first):
src/bsoncxx/CMakeLists.txt:67 (find_package)
所以在这里我尝试了不同的东西,比如将路径添加到 libsson 目录:
cmake -G "Visual Studio 14 2015 Win64" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=C:/mongo-cxx-driver" "-DLIBBSON_DIR=C:/mongo-c-driver/lib/pkgconfig/" "-DLIBMONGOC_DIR=C:/mongo-c-driver/lib/pkgconfig/" "-DBOOST_ROOT=C:/local/boost_1_62_0/"
这实际上有效,但是当我尝试构建时
msbuild.exe ALL_BUILD.vcxproj
我收到一个错误:
C:\Users\Erik\Documents\mongo-cxx-driver-r3.0.1\src\bsoncxx\array\view.cpp(21): fatal error C1083: Cannot open include
file: 'bson.h': No such file or directory [C:\Users\Erik\Documents\mongocxx-driver-r3.0.1\src\bsoncxx\bsoncxx_static.v
cxproj]
这个文件“bson.h”似乎驻留在目录中
C:\mongo-c-driver\include\libbson-1.0
但我不确定它为什么找不到该文件或我如何才能找到它。
非常感谢您对此的任何意见。