【问题标题】:error: expected identifier before '_Bool'错误:“_Bool”之前的预期标识符
【发布时间】:2015-10-27 15:29:20
【问题描述】:

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

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'

发生了什么事?

【问题讨论】:

    标签: pebble-sdk cloudpebble


    【解决方案1】:

    value 联合没有 bool 成员 - 最好的办法是改用 uint8 成员,传递 1 表示真,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);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-03-16
      • 2014-01-31
      • 1970-01-01
      • 2013-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多