【linux学习笔记】在ubuntu下使用QT Cmake支持C++11
今天在ubuntu下使用QT来进行C++编程,选择了Cmake,当用到initializer_list的时候提示不支持C++11,现提供一下解决方案:错误提示:error: This file requires compiler and library support for the \ISO C++ 2011 standard. This support is currently e
·
今天在ubuntu下使用QT来进行C++编程,选择了Cmake,当用到initializer_list的时候提示不支持C++11,现提供一下解决方案:
错误提示:
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.
解决方案:
在CmakeLists.txt中添加:set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
如下列代码所示:
project(lesson)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
cmake_minimum_required(VERSION 2.8)
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})
更多推荐
已为社区贡献1条内容
所有评论(0)