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.7

(2)

安裝的過程中設置環境變量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"


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM