关于make提示must be enabled with the -std=c++11 or -std=gnu++11 compiler options
2016-12-02 19:03
1031 查看
在make后,出现错误,提示如下:
原因是写的CMakeLists.txt文件没有添加对C++11的支持,所以在工程目录下的CMakeLists.txt中添加以下语句:
然后编译即可通过。
其中,参数CMAKE_CXX_FLAGS含义是: set compiler for c++ language
而后面的-O3(是字母opq的o,大写的欧)是用来调节编译时的优化程度的,最高为-O3,最低为-O0(即不做优化)
-Ox这个参数只有在CMake -DCMAKE_BUILD_TYPE=Release时有效,因为debug 版的项目生成的可执行文件需要有调试信息并且不需要进行优化,而 release 版的不需要调试信息但需要优化
/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 版的不需要调试信息但需要优化
相关文章推荐
- 使用python-google-places 一个严重的bug 错误提示:lat_lng must be a dict with the keys, 'lat' and 'lng'
- 关于The function get must be used with a prefix when a default namespace is not specified的错误
- 关于The function size must be used with a prefix when a default namespace is not specified解决
- 提交时提示错误This Bundle is invalid.New apps and app updates submitted to the App Store must be built with
- 关于The function equals must be used with a prefix when a default namespace is not specified解决
- 关于The function equals must be used with a prefix when a default namespace is not specified解决
- Hololens错误提示:can't be loaded because it was not built with the right version or build target.
- cmake+gcc解决extended initializer lists only available with -std=c++11 or -std=gnu++11
- Android Build with Gradle and ProGuard : “The output jar must be specified after an input jar, or it
- Attribute value ("XXX") is quoted with " which must be escaped when used within the value 异常的修正
- The following module was built either with optimizations enabled or without debug information
- 关于 “The import junit cannot be resolved”的提示错误
- Eclipse启动时报错:A Java RunTime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No java virtual machine was found after searching the following locations:…
- 关于FLEX输出时:IE提示"Alternate HTML content should be placed here. This content requires the Adobe Flash Player"
- Synthesized property 'xx' must either be named the same as a compatible ivar or must explicitly name
- 配置文件中出现 The reference to entity "XX" must end with the ';' delimiter. 错误提示
- org.hibernate.QueryException: addEntity() or addScalar() must be called on a sql query before executing the qury 问题的解决
- 问题解决: Attribute value request.getParameter("id") is quoted with " which must be escaped when used within the value
- 报错信息 The jsp:param action must not be used outside the jsp:include, jsp:forward, or jsp:params elements 的原因及解决办法
- Attribute value request.getParameter("digyso") is quoted with " which must be escaped when used within the value