1

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

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 有什么想法吗?谢谢!

4

2 回答 2

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,编译正确。

于 2013-01-05T09:31:28.313 回答
1

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

已解决:我有 v2 的 1.44 boost 库,但在我的标题中有“#define BOOST_FILESYSTEM_VERSION 3”(使用另一个版本的同事添加了它)。如果我评论这个指令,我的代码就会正确编译。看起来我们需要同步我们的库。

于 2012-08-24T08:03:22.383 回答