我是靠谱客的博主 粗犷小松鼠,这篇文章主要介绍关于make提示must be enabled with the -std=c++11 or -std=gnu++11 compiler options,现在分享给大家,希望可以做个参考。


在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 
  ^


原因是写的CMakeLists.txt文件没有添加对C++11的支持,所以在工程目录下的CMakeLists.txt中添加以下语句:

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 版的不需要调试信息但需要优化

最后

以上就是粗犷小松鼠最近收集整理的关于关于make提示must be enabled with the -std=c++11 or -std=gnu++11 compiler options的全部内容,更多相关关于make提示must内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(75)

评论列表共有 0 条评论

立即
投稿
返回
顶部