我正试图跟随本指南,目前我正处于第三步。
所以跑完之后,
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/我尝试执行类似于蒙哥克窗口指南中的命令
如果我这么做
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但是,我不知道为什么它找不到文件,也不知道如何才能这样做。
非常感谢您对此的任何投入。
发布于 2016-10-02 23:32:39
您没有正确设置LIBBSON_DIR和LIBMONGOC_DIR。在您的情况下,它们都应该设置为C:\mongo-c-driver。构建系统将根据需要自动将include和lib添加到该基本路径。您可能会发现,阅读appveyor脚本内容丰富:
CMAKE_INSTALL_PREFIX:https://github.com/mongodb/mongo-cxx-driver/blob/master/appveyor.yml#L25LIBMONGOC_DIR调用CMake时设置CMake和https://github.com/mongodb/mongo-cxx-driver/blob/master/appveyor.yml#L31https://stackoverflow.com/questions/39798679
复制相似问题