2013-03-15 108 views
1

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

这里是错误:

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() 
+0

由于您遇到C++安装,我可以假设你没有问题与C驱动程序构建?因为那是我现在被卡住的地方。在mongodb-dot-org'C++ MongoDB Driver'页面上,它说下载C++驱动程序,然后到这个链接去安装它:https://github.com/mongodb/mongo-cxx-driver/wiki/Quickstart-Guide- (新驱动程序)页面告诉你要做的第一件事是安装** C驱动程序**(如果需要,它也会构建libbson)。 *然后*它指示编译C++驱动程序。我读错了吗?这是两个安装的单个页面,&我只能做后者? – Luv2code 2015-07-22 17:30:27

回答

2

所以,我终于能升压利布斯通过寻找这显示:

scons --extrapath=c:\boost 

的C:\升压被升压的目录。我现在遇到编译器错误,但比以前进一步。

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