C++使用STL时须要注意 你的代码遵循的c++版本 有些特性只有高版本c++才支持 如thread、mutex至少须要c++11c++
g++编译时默认遵循c++98 能够使用-std=<standard>指定c++版本spa
c++版本经历了c++9八、c++0三、c++十一、c++1四、c++17c++11
cpp代码中__cplusplus预约义宏代表了当前编译遵循的c++版本 经g++加-std=<standard>得blog
c++98: #define __cplusplus 199711L编译器
c++03: #define __cplusplus 199711L编译
c++11: #define __cplusplus 201103L
thread
c++14: #define __cplusplus 201402L
gcc
c++17: #define __cplusplus 201500L
gc
以下图im
一样C语言也有版本c8九、c9九、c11
gcc编译时默认遵循c11(可能每一个编译器默认使用的不一样) 能够使用-std=<standard>指定c版本