Compile Failing for iOS 4 with Sqlite
I wrote an iPhone app against SDK 2.2, I have updated my XCode and SDK so now I only have SDK 4.2 and I want to update my app to run with that.
The problem is I can't even get it to compile!
I get the following error:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/include/sqlite3.h:5772: error: expected '=', ',', ';', 'asm' or 'attribute' before 'int'
The line in question is:
SQLITE_API int sqlite3_rtree_geometry_callback( sqlite3 *db, const char *zGeom, int (*xGeom)(sqlite3_rtree_geometry *, int nCoord, double *aCoord, int *pRes), void *pContext );
I have tried relinking the ne开发者_如何学Pythonwer sqlite frameworks, both libsqlite3.dylib and libsqlite3.dylib, but both still cause this error.
If I comment out my import statement (#import "sqlite3.h"), it compiles just fine. (Although it crashes when I run it, obviously.)
I've used the same way Sqlite.h use to import this library:
#import <sqlite3.h>
and it solved the issue.
I ended up creating a new project, and importing all the files from the original, and then linking the sqlite framework. After that it compiled just fine.
I managed to make it work after replacing #import "sqlite3.h" by #import "/usr/include/sqlite3.h"
精彩评论