错误:'_Bool'

时间:2015-10-27 15:29:20

标签: pebble-sdk cloudpebble

我以前在处理同步元组时有以下代码:

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);
}

然而,我只是尝试构建它(在Cloud Pebble中),并得到了错误:

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

发生了什么事?

1 个答案:

答案 0 :(得分:1)

bool联盟中没有value成员 - 您最好的选择是使用uint8成员,将1传递给true,将0传递给false:

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);
}