加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

我的linux的gcc编译器不支持布尔值

发布时间:2020-05-23 10:49:52 所属栏目:Linux 来源:互联网
导读:参见英文答案 Using boolean values in C13个我正在尝试使用返回类型作为boolean创建一个函数...程序的语法似乎是正确的但编译器给出错误....我包含的头文件是:#includestdio.h #includestdlib.

参见英文答案 > Using boolean values in C13个
我正在尝试使用返回类型作为boolean创建一个函数…程序的语法似乎是正确的但编译器给出错误….

我包含的头文件是:

#include

我创建的功能是:

34.bool checknull(struct node* node){
35.    if ( node != NULL )
36.        return TRUE;
37.       
38.    return false;
39.}

我在编译时得到的是

bininsertion.c:34:1: error: unknown type name ‘bool’
bininsertion.c: In function ‘checknull’:
bininsertion.c:36:10: error: ‘TRUE’ undeclared (first use in this function)
bininsertion.c:36:10: note: each undeclared identifier is reported only once for each  function it appears in
bininsertion.c:38:9: error: ‘false’ undeclared (first use in this function)

我用小写和大写字母都试过“真,假”,但似乎没有用…… 最佳答案 你应该包括< stdbool.h>如果你想要布尔,真假.这也是事实,不是真的.

如果你不想包含stdbool.h,你可以使用稍微丑陋的_Bool.

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读