在make后,出现错误,提示如下:
/usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
^
SET( CMAKE_CXX_FLAGS "-std=c++11 -O3")
然后编译即可通过。
其中,参数CMAKE_CXX_FLAGS含义是: set compiler for c++ language
而后面的-O3(是字母opq的o,大写的欧)是用来调节编译时的优化程度的,最高为-O3,最低为-O0(即不做优化)
-Ox这个参数只有在CMake -DCMAKE_BUILD_TYPE=Release时有效,因为debug 版的项目生成的可执行文件需要有调试信息并且不需要进行优化,而 release 版的不需要调试信息但需要优化