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

时间:2012-08-24 07:48:02

标签: 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 有任何想法吗 ?谢谢!

2 个答案:

答案 0 :(得分:3)

我遇到了同样的问题。
在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,编译正确。

答案 1 :(得分:1)

来自互联网的一些解决方案:

  

已解决:我拥有1.44增强库的v2,但有#34; #define BOOST_FILESYSTEM_VERSION 3"在我的标题中(使用其他版本的同事添加了它)。如果我评论这个指令,我的代码编译正确。看起来我们需要同步我们的库。