【问题标题】:Mongodb C++ driver install on Linux在 Linux 上安装 Mongodb C++ 驱动程序
【发布时间】:2012-08-24 07:48:01
【问题描述】:

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

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

【问题讨论】:

    标签: linux mongodb boost scons


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

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

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

      【讨论】:

      • 只要评论这个指令,一切都好吗?
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-25
      相关资源
      最近更新 更多