编译MongoDB C ++驱动程序,增加错误(Windows)

时间:2013-03-15 20:26:18

标签: mongodb boost

我正在尝试在Windows上编译MongoDB C ++驱动程序。我正在使用SCons“Make”工具。它给了我一个Boost错误,我有启动库,但我不确定如何让它与SCons Build文件链接。我只是在VS中添加引用。看起来我需要一个环境变量引用,但我不确定。

这是错误:

scons mongoclient
scons: Reading SConscript files ...
Checking for C++ library boost_thread-mt... (cached) no
Checking for C++ library boost_thread... (cached) no
Checking for C++ library boost_filesystem-mt... (cached) no
Checking for C++ library boost_filesystem... (cached) no
Checking for C++ library boost_system-mt... (cached) no
Checking for C++ library boost_system... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
cl /Fobuild\mongo\bson\oid.obj /c src\mongo\bson\oid.cpp /TP /nologo /EHsc /O2 /
D_SCONS /DMONGO_EXPOSE_MACROS /Ibuild /Isrc /Ibuild\mongo /Isrc\mongo
oid.cpp
src\mongo/pch.h(48) : fatal error C1083: Cannot open include file: 'boost/shared
_ptr.hpp': No such file or directory
scons: *** [build\mongo\bson\oid.obj] Error 2
scons: building terminated because of errors.
在SConstruct文件中的

我发现以下内容但不确定找到boost库的确切含义。

boostLibs = ["thread", "filesystem", "system"]
conf = Configure(env)
for lib in boostLibs:
    if not conf.CheckLib(["boost_%s-mt" % lib, "boost_%s" % lib],
                         language="C++"):
        if not win:
            Exit(1)
conf.Finish()

2 个答案:

答案 0 :(得分:2)

所以我终于能够通过找到这个来提升Libs了:

scons --extrapath=c:\boost

C:\ boost是boost的目录。我现在遇到编译器错误,但这比以前更进一步。

答案 1 :(得分:0)

您可以使用--cpppath选项

添加其他包含路径
--cpppath : Include path if you have headers in a nonstandard directory

此外,请记住编译引导库并链接到包含boost库.lib文件的正确文件夹

--libpath : Library path if you have libraries in a nonstandard directory

因此,你应该发出类似于:

的命令
scons --cpppath=c:\boost --libpath=c:\boost\stage\lib