Code::Blocks 12.11 error: ‘nullptr’ was not declared in this scope&GNU GCC -std=gnu++0x
来源:互联网 发布:iptv管理系统源码下载 编辑:程序博客网 时间:2024/06/11 18:48
C++primer英文版(第五版)p54 Null Pointers章节:
Modern C++ programs generally should avoid using NULL and use nullptr instead.本人通俗理解为指针初始化尽量用nullptr而避免用NULL。于是乎用Code::Blocks敲敲代码,问题来了。
error: ‘nullptr’ was not declared in this scope
于是网上Google答案,一大堆英文,最后大概了解到是GNU GCC编译器的问题,而不是Code::Blocks这个IDE问题,只需要在编译器里敲入命令行-std=gnu++0x。
解决方法:Code::Blocks集成了GNU GCC编译器,所以 菜单栏->Setting->compiler…,选择Global compiler settings页面,页面上部selected compiler选择GNU GCC Comiler,然后页面选择中部选择Compiler settings->Compiler Flags,勾选Have g++ follow the coming C++0x ISO C++ language standard [-std=gnu++0x],图片一切明了:
好了,接下来再编译就成功啦!O(∩_∩)O~
0 0
- Code::Blocks 12.11 error: ‘nullptr’ was not declared in this scope&GNU GCC -std=gnu++0x
- error: ‘nullptr’ was not declared in this scope
- error: 'nullptr' was not declared in this scope
- nullptr was not declared in this scope
- C++之‘nullptr’ was not declared in this scope
- ndk编译错误:error: 'nullptr' was not declared in this scope
- gcc inet_addr was not declared in this scope 解决
- gcc inet_addr was not declared in this scope
- Fixed itk-3.20.1 on gcc-4.8, error: ‘memcpy’ was not declared in this scope
- Code::Block 'shared_ptr' was not declared in this scope
- error: '_localtime_not_threadsafe_' was not declared in this scope
- error: ‘exit’ was not declared in this scope
- error: `cout' was not declared in this scope
- error: 'UINT64_C' was not declared in this scope
- error: 'memcpy' was not declared in this scope
- error: 'memcpy' was not declared in this scope的解决
- error: ‘BYTE’ was not declared in this scope
- error: ‘closesocket’ was not declared in this scope
- 使用Stacktrace处理异常
- Linux下模块编译 MODPOST 0
- Mysql常用命令
- LeetCode 058 Length of Last Word
- 自定义Xcode插件实现
- Code::Blocks 12.11 error: ‘nullptr’ was not declared in this scope&GNU GCC -std=gnu++0x
- 达达日志收集系统
- Java IO之Socket通信
- Arborescent曲线
- mybatis不能插入,查询中文的问题以及可能的解决办法,以及Mysql数据库编码的设置
- Flume日志收集分层架构应用实践
- Git 笔记
- 可引导MBR的利用
- C++ error