简体   繁体   English

错误:“ _ Bool”之前的预期标识符

[英]error: expected identifier before '_Bool'

I previously had the following code when dealing with my sync tuple: 处理同步元组时,我以前有以下代码:

static void sync_tuple_changed_callback(const uint32_t key, const Tuple* new_tuple, const Tuple* old_tuple, void* context) {
  persist_write_bool(key,new_tuple->value->bool);
}

However, I just tried building this (in Cloud Pebble), and got the error: 但是,我只是尝试在Cloud Pebble中构建它,并得到了错误:

../src/main.c: In function 'sync_tuple_changed_callback':
../src/main.c:25:44: error: expected identifier before '_Bool'

What's going on? 这是怎么回事?

There is no bool member of the value union - your best bet is to use the uint8 member instead, passing 1 for true and 0 for false: value联合没有bool成员-最好的选择是使用uint8成员,为true传递1,为false传递0:

static void sync_tuple_changed_callback(const uint32_t key, const Tuple* new_tuple, const Tuple* old_tuple, void* context) {
  persist_write_bool(key,new_tuple->value->uint8 != 0);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM