Linux C使用bool类型 出现错误expected '=', ',', ';', 'asm' or '__attribute__'
来源:互联网 发布:写作软件知乎 编辑:程序博客网 时间:2024/06/14 22:13
今天在linux下编了一个C程序,用到了bool类型,在编译的程序的时候出现以下错误:
//error: expected '=', ',', ';', 'asm' or '__attribute__'
查找了半天,发现要包含stdbool.h头文件,原因如下:
在C99中,可以直接使用_Bool表示布尔类型(而我使用的是bool),但不可以直接使用false和true,要自己定义,例如:
#define true 1
#define false 0
在定义了true和false之后才可以直接使用。
头文件stdbool.h中,对布尔类型进行了扩展,增加了关键字bool,而且定义了false和true的宏,所以包含了stdbool.h头文件便可以直接使用bool了。
#include <stdbool.h>
阅读全文
0 0
- Linux C使用bool类型 出现错误expected '=', ',', ';', 'asm' or '__attribute__'
- gcc编译,出现错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ........
- Objective-C编译错误:expected '=', ',', ';', 'asm' or '__attribute__' before ***
- expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token gcc编译错误
- NDK编译错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
- 提示错误“expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token“
- 【编程经验】错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘namespace’
- C -- error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
- “expected '=', ',', ';', 'asm' or '__attribute__' before 'void'”
- expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
- expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
- expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
- error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
- error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ’***'
- expected '=', ',', ';', 'asm' or '__attribute__' before
- expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
- expected '=', ',', ';', 'asm' or '__attribute__' before xxx
- /usr/include/ctype.h:48: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘enum’
- OpenGL学习资料汇总
- JS JSON和字符串相互转换
- FragmentManager is already executing transactions
- Android上定义播放器控件UniversalVideoView
- 2017-11-20
- Linux C使用bool类型 出现错误expected '=', ',', ';', 'asm' or '__attribute__'
- Xcode – iOS Deployment Target 支持iOS7.0以下低版本 与 Base SDK 配置低版本iOS SDK运行环境
- MATLAB中分类器的比较
- ubuntu下安装启动nginx
- 接口回调应该注意的问题
- MongoDB的原理
- mysql中in函数和find_in_set函数的区别详解
- pom.xml详解
- VirtualBox虚拟机配置CentOS7网络图文详解教程(转)