gcc warning "will be initialized after [-Wreorder]
来源:互联网 发布:ubuntu输入法乱码 编辑:程序博客网 时间:2024/05/16 18:12
gcc warning "will be initialized after [-Wreorder]
构造函数时,初始化成员变量的顺序要与类声明中的变量顺序相对应,若不对应,则出现如题错误。解决方法就是按照顺序进行初始化。
对这个问题,StackOverflow上也发生了讨论,以下摘录原文:
Question:
I am getting a lot of these warnings from 3rd party code that I cannot modify. Is there a way to disable this warning or at least disable it for certain areas (like #pragma push/pop in VC++)?
Example:
list.h:1122: warning: `list<LogOutput*, allocator<LogOutput*> >::node_alloc_' will be initialized after list.h:1117: warning: `allocator<LogOutput*> list<LogOutput*, allocator<LogOutput*> >::alloc_'Best Answer :Make sure the members appear in the initializer list in the same order as they appear in the class
Class C { int a; int b; C():b(1),a(2){} //warning, should be C():a(2),b(1) }
or you can turn -Wno-reorder
Another Answer:
For those using QT having this error, add this to .pro file QMAKE_CXXFLAGS_WARN_ON += -Wno-reorder
原文链接:http://stackoverflow.com/questions/1564937/gcc-warning-will-be-initialized-after
0 0
- gcc warning "will be initialized after [-Wreorder]
- gcc compiler warning: “will be initialized after/when initialized here”
- gcc compiler warning: “will be initialized after/when initialized here”
- 解决编译warning:warning: ‘MeteringUnit::voltage_gain_’ will be initialized after [-Wreorder]
- 嵌入式 解决编译warning:warning: ‘MeteringUnit::voltage_gain_’ will be initialized after [-Wreorder]
- QT问题记录之warning: ‘xxx’ will be initialized after [-Wreorder]
- gcc warning:‘Test::b’will be initialized after
- will be initialized after [-Wreorder], 类成员构造顺序
- will be initialized after
- xxx will be initialized after
- Warning::'XXX' will be initialized later
- 解决Warning中Wreorder
- gcc 编译器[-Wreorder]问题
- warning: LF will be replaced by CRLF
- warning: LF will be replaced by CRLF
- warning: LF will be replaced by CRLF
- warning: LF will be replaced by CRLF
- 解决QT中Warning中Wreorder
- SDWebImage的简单使用
- 远程不能连接本地数据库
- C语言结构体做参数易错情况分析
- 初次接触volley网络框架,进行初步封装使用
- 通过六个题目彻底掌握String笔试面试题
- gcc warning "will be initialized after [-Wreorder]
- MTK android平台添加读写i2c设备工具
- 面试题 29
- <一>Copy和mutableCopy——iOS开发的疑惑
- iOS指纹识别
- 浅谈sharepoint的权限的研究
- cadence16.5中XNET的设置方法
- 关于delegate 与 protocol 的理解 iOS
- 程序设计vs 写作