sqlite3使用llvm编译器编译错误
使用 llvm 2.0
编译器在新的 xcode4 上编译我的项目时,我收到来自标准
标头的奇怪错误。问题出在以下行:
//<sqlite3.h>
typedef struct sqlite3 sqlite3;
错误消息:
In file included from /Projects/trunk/MyProj/Classes/StatsProvider.m:14:
Elaborated type refers to a non-tag type in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/include/sqlite3.h
使用 GCC 4.2 项目编译没有问题
如何修复该错误?
Compiling my project on new xcode4 using llvm 2.0
compiler I get a strange error coming from standard <sqlite3.h>
header. Problem is with the following line:
//<sqlite3.h>
typedef struct sqlite3 sqlite3;
Error message:
In file included from /Projects/trunk/MyProj/Classes/StatsProvider.m:14:
Elaborated type refers to a non-tag type in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/include/sqlite3.h
Using GCC 4.2 project compiles with no problem
How can I fix that error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的猜测:您正在将 sqlite 编译为 C++ 代码,而您应该将其编译为纯 C 代码。 class/struct 关键字在 C++ 中隐式引入 typedef,但在 C 中则不然。
My guess: you are compiling sqlite as C++ code, whereas you should compile it as plain C code. class/struct keywords implicitly introduce a typedef in C++, but not so in C.
我将错误消息解释为编译器在没有看到具有该名称的结构声明时抱怨使用 struct sqlite3 。结构名称位于特殊的“标记空间”中。
我的下一个猜测是新编译器比旧编译器更严格,并且发现了一个错误。
I interpret the error message as the compiler complaining about using
struct sqlite3
when it hasn't seen a struct declaration with that name. Struct names are in a special "tag-space".My next guess is that the new compiler is stricter than the old one, and has found a bug.