安装教程:https://mongodb.github.io/mongo-cxx-driver/mongocxx-v3/installation/
(1)
“initializer_list” file not found
http://*.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://*.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"