mongodb c++ driver安装踩坑记

 安装教程:https://mongodb.github.io/mongo-cxx-driver/mongocxx-v3/installation/

(1)

“initializer_list” file not found

http://stackoverflow.com/questions/19493671/initializer-list-no-such-file-or-directory

Since you are using GCC-4.8 and your problem is that you don't have the C++11 features try to add -std=c++11 to your compilation line.

I saw that you are using CMake, then this post may help you (you can replace -std=c++0x by -std=c++11 or -std=gnu++11).

Example:

# It appends the -std=c++11 option to CMAKE_CXX_FLAGS
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") # for gcc >= 4.7

# Or
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") # for gcc < 4.72)

安装的过程中设置环境变量CPLUS_INCLUDE_PATH 指明mongoc和bson的inlcude目录:

http://stackoverflow.com/questions/2497344/what-is-the-environment-variable-for-gcc-g-to-look-for-h-files-during-compila

Just look at the actual gcc documentation. It's all explained there.

To summarize:

  • LIBRARY_PATH is for the linker, not for header files (used when looking for libraries requested by a -l option)
  • CPATH specifies directories to look for header files in (like the -I option)
  • C_INCLUDE_PATH and CPLUS_INCLUDE_PATH are like CPATH, but for C/C++ respectively

 (3)自己下载c++17的模拟库,然后放在本地,修改make file里git clone的路径

https://github.com/mnmlstc/core/tree/v1.1.0

(4) 

LD_LIBRARY_PATH="/usr/local/lib"

posted @   bonelee  阅读(2497)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· DeepSeek 开源周回顾「GitHub 热点速览」
点击右上角即可分享
微信分享提示