【问题标题】:Xcode (LLVM) and SQLite: error: incomplete definition of type 'struct Btree'Xcode (LLVM) 和 SQLite:错误:“struct Btree”类型的定义不完整
【发布时间】:2012-11-12 11:23:25
【问题描述】:

我对此感到困惑.... SQLite 是一个单独的项目,也是工作区的一部分。构建目标时,LLVM 抱怨:

<path>/sqlite3.c:44924:24: Incomplete definition of type 'struct Btree'

位于第 44924 行(以及 44924 之后的 14 个其他地方)。这是我看到的其他内容:

7145: /* Forward declaration */
7146: typedef struct Btree Btree;
...

11378: struct Btree {
11379:   sqlite3 *db;       /* The database connection holding this btree */
11380:   BtShared *pBt;     /* Sharable content of this btree */
11381:  u8 inTrans;        /* TRANS_NONE, TRANS_READ or TRANS_WRITE */
11382:  u8 sharable;       /* True if we can share pBt with another db */
11383:  u8 locked;         /* True if db currently has pBt locked */
11384:  int wantToLock;    /* Number of nested calls to sqlite3BtreeEnter() */
11385:  int nBackup;       /* Number of backup operations reading this btree */
11386:  Btree *pNext;      /* List of other sharable Btrees from the same db */
11387:  Btree *pPrev;      /* Back pointer of the same list */
11388:#ifndef SQLITE_OMIT_SHARED_CACHE
11389:  BtLock lock;       /* Object used to lock page 1 */
11390:#endif
11391:};
...

44919: static void lockBtreeMutex(Btree *p){
44920:   assert( p->locked==0 );
44921:   assert( sqlite3_mutex_notheld(p->pBt->mutex) );
44922:   assert( sqlite3_mutex_held(p->db->mutex) );
44923: 
44924:   sqlite3_mutex_enter(p->pBt->mutex);
44925:   p->pBt->db = p->db;
44926:   p->locked = 1;
44927: }

我还尝试将 11378 处的结构重命名为 struct Btree_S(并更改了 typedef)。同样的问题。

我想我的问题是,它怎么可能不完整?有什么想法吗?

【问题讨论】:

  • 尝试查看预处理的源代码;预处理器可以对源代码做一些奇怪的事情。此外,如果您询问编译器诊断,请提供完整的诊断输出。
  • 感谢@servn。我正在尝试清理拒绝,我认为它与stackoverflow.com/questions/13327744/… 有关。我很快就会得到输出。
  • 你的sqlite3.c版本中的第44924行是什么?
  • @CL - 添加信息。

标签: xcode sqlite llvm


【解决方案1】:

确保 sqlite3.c 编译为 C,而不是 C++。

【讨论】:

  • 谢谢 CL。我知道如何调出构建设置,但是如何为 Xcode 中的文件(而不是项目)执行此操作。我右键单击 sqllite3.c,在“显示文件检查器”之后我什么也没得到。
  • 谢谢 CL。积分是你的,因为你犯了我的错误。
【解决方案2】:

找到答案.... 预处理器宏 SQLITE_HAS_CODEC=1 未定义。为什么没有定义?因为Xcode 4: Project does not honor $(inherited) Build Setting in Workspace?

$(inherited) 在 Xcode 4 中无法在父/子关系中的项目中正常工作(尽管 IDE 的树形视图向我们显示了),以及文档对$(inherited) 的暗示。

Xcode 配置文件 (xcconfig) 也无法按预期工作。我无法将配置文件分配给其他子项目(仅限顶级项目)。

Apple 应该解雇他们的整个 QA 部门和技术作家,并雇佣一批新的 ID10T。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-08-27
    • 2011-11-28
    • 1970-01-01
    • 2021-05-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多