我已经安装了这个驱动很长时间了,但是失败了。同样的错误如下:
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/