linux - 在 Linux 上安装 Mongodb C++ 驱动程序

标签 linux mongodb boost scons

我已经安装了这个驱动很长时间了,但是失败了。同样的错误如下:

scons: Reading SConscript files ...
Checking for C++ library boost_thread-mt... (cached) no
Checking for C++ library boost_thread... (cached) yes
Checking for C++ library boost_filesystem-mt... (cached) no
Checking for C++ library boost_filesystem... (cached) yes
Checking for C++ library boost_system-mt... (cached) no
Checking for C++ library boost_system... (cached) yes
scons: done reading SConscript files.
scons: Building targets ...
g++ -o build/mongo/client/dbclient_rs.o -c -O3 -pthread -D_SCONS -DMONGO_EXPOSE_MACROS -Ibuild -Isrc -Ibuild/mongo -Isrc/mongo src/mongo/client/dbclient_rs.cpp
In file included from /usr/local/include/boost/filesystem/path.hpp:24,
                 from src/mongo/util/paths.h:26,
                 from src/mongo/db/client.h:38,
                 from src/mongo/db/curop.h:23,
                 from src/mongo/db/curop-inl.h:1,
                 from src/mongo/db/instance.h:23,
                 from src/mongo/db/dbmessage.h:25,
                 from src/mongo/client/dbclient_rs.cpp:27:
/usr/local/include/boost/filesystem/config.hpp:16:5: error: #error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3
scons: *** [build/mongo/client/dbclient_rs.o] Error 1
scons: building terminated because of erro`enter code here`rs.`enter code here`

在安装之前,我已经安装了boost 1.5,pcre8.3,我要安装mongodb驱动2.2 有任何想法吗 ?谢谢!

最佳答案

我遇到了和你一样的问题。
在 mongodb C++ 驱动源 src/mongo/pch.h

#define BOOST_FILESYSTEM_VERSION 2

但是在 /usr/local/include/boost/filesystem/config.hpp 中:

# if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 3
#   error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3
# endif

这就是问题所在。
我将 src/mongo/pch.h 更改为

#define BOOST_FILESYSTEM_VERSION 3

然后再次scons,编译正确。

关于linux - 在 Linux 上安装 Mongodb C++ 驱动程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12105202/

相关文章:

javascript - mongodb 与 typescript `toArray` 方法不起作用

javascript - 如何解决 Mongoose 对象保存问题?

C++ boost :asio what happens to server class when session class is deleted

使用 Mongoose 到 MongoDB 的 Node.js SSH 隧道

ubuntu - 我的 apt 在安装 boost 时搞砸了

linux - CMakeLists 无法找到新安装的 HDF5?

c++ - 概括应用程序的用户界面

linux - 使用由另一列中的值定义的滑动窗口对数字列求和

c# - 交互式 c# System.Process 不回显输入

linux - 在 rhel 7 中安装 docker 1.12 时出现依赖错误