warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11

简介: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11

有以下报警:

warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11

吾见报警,必去之。这个怎么去?根据提示即可。加上编译参数:

gcc  -std=c++11
g++  -std=c++11

如果是VS呢?评论中有网友说:

Project->Properties->C++ Build->Misc Options加上即可。

目录
相关文章
|
3月前
|
安全 C++
C++: std::once_flag 和 std::call_once
`std::once_flag` 和 `std::call_once` 是 C++11 引入的同步原语,确保某个函数在多线程环境中仅执行一次。
|
7月前
|
算法 前端开发 大数据
【C/C++ 基础知识 】C++中易混淆的函数和关键字:std::find vs std::search,std::remove vs std::erase,remove vs delete
【C/C++ 基础知识 】C++中易混淆的函数和关键字:std::find vs std::search,std::remove vs std::erase,remove vs delete
166 0
|
7月前
|
安全
C++11中的std::call_once
C++11中的std::call_once
VS2005 error C2864 only static const integral data members can be initialized within a class
VS2005 error C2864 only static const integral data members can be initialized within a class
|
C++
warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
199 0
error: ‘to_string‘ is not a member of ‘std‘ 或 error: ‘thread‘ is not a member of ‘std‘ 原因及解决办法
error: ‘to_string‘ is not a member of ‘std‘ 或 error: ‘thread‘ is not a member of ‘std‘ 原因及解决办法
1861 0
解决办法:error LNK2005: "void * __cdecl operator new(unsigned int)" 已经在 LIBCMTD.lib(new.obj) 中定义
解决办法:error LNK2005: "void * __cdecl operator new(unsigned int)" 已经在 LIBCMTD.lib(new.obj) 中定义
277 0
解决办法:error: ‘unordered_map’ in namespace ‘std’ does not name a template type
解决办法:error: ‘unordered_map’ in namespace ‘std’ does not name a template type
552 0
|
Java C++
程序运行问题排查和解决:an instance of ‘std::logic_error‘what(): basic_string::_M_construct null not valid
程序运行问题排查和解决:an instance of ‘std::logic_error‘what(): basic_string::_M_construct null not valid
1954 0

推荐镜像

更多