如何使用c++;mongodb的司机? 请告诉我如何使用MunGDB的C++驱动程序来构建程序。 不要抱怨我的英语不好
我的环境如何使用c++;mongodb的司机? 请告诉我如何使用MunGDB的C++驱动程序来构建程序。 不要抱怨我的英语不好,c++,mongodb,visual-studio-2012,boost,C++,Mongodb,Visual Studio 2012,Boost,我的环境 Windows7 64位 Visual Studio Ultimate 2012(x64版本目标项目) 我执行了以下步骤 我安装了ptython2.7.2、pythonforwindows扩展和scons2.3.0 我安装了boost 1.54.0。我执行了'boostrap'和'b2-a--build type=complete--address model=64--link=static--runtime link=static' 我下载mongodb-linux-x86_6
- Windows7 64位
- Visual Studio Ultimate 2012(x64版本目标项目)
- 我安装了ptython2.7.2、pythonforwindows扩展和scons2.3.0
- 我安装了boost 1.54.0。我执行了'boostrap'和'b2-a--build type=complete--address model=64--link=static--runtime link=static'
- 我下载mongodb-linux-x86_64-v2.4-latest.tgz
- 我在SConstruct中添加了以下文本
env.Append(CPPPATH=['C:\\boost\\boost_1_54_0']) env.Append(LIBPATH=['C:\\boost\\boost_1_54_0\\stage\\lib']) env.Append(CPPDEFINES=["_UNICODE"]) env.Append(CPPDEFINES=["UNICODE"])
- 我演了《scons mongoclient》
- 我做了VisualStudioC++的项目。
- 我在项目中设置了“Release”和“x64”
- 在属性页/Configuration Properties/C C++/General/Additional Include目录中,我设置了“C:\boost\boost\u 1\u 54\u 0”和“C:\mongo\mongo-cxx-driver-v2.4\src”
- 在属性页/配置属性/链接器/常规/附加库目录中, 我设置了“C:\boost\boost\u 1\u 54\u 0\stage\lib”和“C:\mongo\mongo-cxx-driver-v2.4”
- 在属性页/configurationproperties/Linker/Input/Additional Dependences中,我设置了'mongoclient.lib'、'ws2_32.lib'和'psapi.lib'
- 在属性页/configurationproperties/Linker/Input/Ignore特定的默认库中,我设置了'msvcprt.lib'和'LIBCMT.lib'
- 在属性页/configurationproperties/C++/preposessor/Preprocessor定义中,我设置了“\u CRT\u SECURE\u NO\u WARNINGS”
- 在属性页/配置属性/C++/代码生成/运行时库中,我设置了“多线程(/MT)”
1>mongoclient.lib(stringutils.obj) : error LNK2001: unresolved external symbol __security_check_cookie
1>mongoclient.lib(initializer_dependency_graph.obj) : error LNK2001: unresolved external symbol __security_check_cookie
1>mongoclient.lib(initializer.obj) : error LNK2001: unresolved external symbol __security_check_cookie
....
fatal error LNK1120: 154 unresolved externals
如果你指出台阶上有什么奇怪的地方,我会帮你的
谢谢.< /P> < P> <强>如何构建MangGDB C++驱动程序< /强>
此解决方案在具有以下特征的机器上获得成功:- 步骤1
下载MunGDB C++驱动程序:
您可以使用Git创建克隆或将其下载为.zip文件(我做了第二个),您将得到一个类似mongo-cxx-driver-legacy.zip的文件。将其解压缩到工作目录中的mongo cxx driver legacy文件夹中- 步骤2
- 步骤3
- 步骤4
- 步骤5
- 步骤6
- 步骤7
- 步骤8
- 步骤9
在Windows资源管理器导航到安装MunGDB C++驱动程序的文件夹中,进入子文件夹LIB(在我的例子中是D:MungDbcpluplplsCorclie\Mango CXX驱动程序遗产\蒙哥卡CXX驱动程序遗产\LIB),并重命名文件 #include <cstdint>
#include <iostream>
#include <vector>
#include <bsoncxx/json.hpp>
#include <mongocxx/client.hpp>
#include <mongocxx/stdx.hpp>
#include <mongocxx/uri.hpp>
using bsoncxx::builder::stream::close_array;
using bsoncxx::builder::stream::close_document;
using bsoncxx::builder::stream::document;
using bsoncxx::builder::stream::finalize;
using bsoncxx::builder::stream::open_array;
using bsoncxx::builder::stream::open_document;