mongodb的C/C++驱动安装

本文详细介绍了MongoDB的C/C++驱动安装过程,包括安装C驱动、CXX驱动,以及解决可能出现的问题,如添加库搜索路径。通过一系列文章链接和官方文档,指导读者完成从安装到测试的基本 CRUD 操作。
摘要由CSDN通过智能技术生成

自己收集了一些安装时候看的文章
https://www.jianshu.com/p/d77680254418
https://www.jianshu.com/p/c982a2960175
https://blog.51cto.com/juestnow/1950039
https://github.com/mongodb/mongo-cxx-driver
http://mongocxx.org/mongocxx-v3/installation/
http://mongoc.org/libmongoc/1.13.0/tutorial.html#basic-crud-operations
http://mongoc.org/libmongoc/current/installing.html

安装C++驱动之前要安装好C的驱动
安装CXX

git clone https://github.com/mongodb/mongo-cxx-driver.git
cd mongo-cxx-driver
cd build/
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig cmake -DCMAKE_BUILD_TYPE=Release -DBSONCXX_POLY_USE_MNMLSTC=1 -DCMAKE_INSTALL_PREFIX=/usr/local ..
sudo make EP_mnmlstc_core 
sudo make && sudo make install

C的测试
往集合插入hello world

/*
gcc -o insert insert.c -I/usr/local/include/libmongoc-1.0 -I/usr/local/include/libbson-1.0 -I/usr/local/include/libbson-1.0/bson/ -lmongoc-1.0 -lbson-1.0

*/
#include <bson/bson.h>
#include <mongoc/mongoc.h>
#include <stdio.h>

int
main (int   argc,
      char 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值