I recently opened an existing project from a time before I installed Xcode 4.1. At first there were many errors and I corrected the problem by chosing LLVM 2.1 as the option for the compiler. All of the errors but one have been cleared up, in sqlite3.h this line is causing a problem:
我最近在安装Xcode 4.1之前就打开了一个现有项目。起初有很多错误,我通过选择LLVM 2.1作为编译器的选项来纠正问题。所有的错误,但一个已被清除,在sqlite3.h这行导致了一个问题:
SQLITE_API int sqlite3_enable_shared_cache(int) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_2_0, __IPHONE_5_0);
SQLITE_API int sqlite3_enable_shared_cache(int)__ OSX_AVAILABLE_BUT_DEPRECATED(__ MAC_10_0,__ MAC_10_7,__ IPHONE_2_0,__ IPHONE_5_0);
The error message reads:
错误消息显示为:
Expected function body after function declarator.
函数声明符后的预期函数体。
Any help is greatly appreciated,
任何帮助是极大的赞赏,
Thanks!
3 个解决方案
#1
29
I had the same problem. I changed my code which said
我有同样的问题。我改变了我说的代码
#include "/usr/include/sqlite3.h"
to
#include <sqlite3.h>
and that fixed it. Perhaps you are picking up the wrong header file somehow.
并修复了它。也许你以某种方式拿起了错误的头文件。
#2
1
i had the same problem. Opened an old project in latest Xcode. sqllite3.h causing errors.
我有同样的问题。在最新的Xcode中打开了一个旧项目。 sqllite3.h导致错误。
I noticed if you click on the sqlite3.h in your code that caused the error and open it in xcode, the right click and show in finder you get
我注意到你在你的代码中单击导致错误的sqlite3.h并在xcode中打开它,右键单击并在finder中显示你得到的
/usr/include/sqlite3.h
yet when you go to the dylib
然而,当你去dylib
Project > Targets > Project Name > Build Phases tab > Link Binary with Library section > libsqlite3.lib > right click and Show in Finder
you get
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libsqlite3.lib
and the headers for this are in a parallel folder
并且此标题位于并行文件夹中
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/include/sqllite3.h
more importantly the .h files were different versions
更重要的是.h文件是不同的版本
The one in the iPhone SDk dir was
iPhone SDk目录中的那个是
#define SQLITE_VERSION "3.7.2"
The one in the Mac /usr/include
Mac / usr / include中的那个
#define SQLITE_VERSION "3.7.5"
in /usr/include SQLITE_VERSION "3.7.5" the macro throwing the error is defined __OSX_AVAILABLE_BUT_DEPRECATED
在/ usr / include SQLITE_VERSION“3.7.5”中定义抛出错误的宏__OSX_AVAILABLE_BUT_DEPRECATED
SQLITE_API int sqlite3_enable_shared_cache(int) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_2_0, __IPHONE_5_0);
But In The one in the iPhone SDk 4.3 / sqlite "3.7.2"
但在iPhone SDk 4.3 / sqlite“3.7.2”中的那个
SQLITE_API int sqlite3_enable_shared_cache(int);
for same definition its not.
对于相同的定义,它不是。
the fix mentioned above works
上面提到的修复工作
CHANGE EVERY #include "/usr/include/sqlite3.h"
to
#include <sqlite3.h>
#3
0
Same problem here. I did read somewhere that upgrading to Xcode 4.2 may fix this bug. However, Xcode 4.2 is not currently an approved deployment tool for the App Store, so that's not an option.
同样的问题在这里我确实在某处读过升级到Xcode 4.2可以解决这个问题。但是,Xcode 4.2目前不是App Store的批准部署工具,因此不是一个选项。
#1
29
I had the same problem. I changed my code which said
我有同样的问题。我改变了我说的代码
#include "/usr/include/sqlite3.h"
to
#include <sqlite3.h>
and that fixed it. Perhaps you are picking up the wrong header file somehow.
并修复了它。也许你以某种方式拿起了错误的头文件。
#2
1
i had the same problem. Opened an old project in latest Xcode. sqllite3.h causing errors.
我有同样的问题。在最新的Xcode中打开了一个旧项目。 sqllite3.h导致错误。
I noticed if you click on the sqlite3.h in your code that caused the error and open it in xcode, the right click and show in finder you get
我注意到你在你的代码中单击导致错误的sqlite3.h并在xcode中打开它,右键单击并在finder中显示你得到的
/usr/include/sqlite3.h
yet when you go to the dylib
然而,当你去dylib
Project > Targets > Project Name > Build Phases tab > Link Binary with Library section > libsqlite3.lib > right click and Show in Finder
you get
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libsqlite3.lib
and the headers for this are in a parallel folder
并且此标题位于并行文件夹中
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/include/sqllite3.h
more importantly the .h files were different versions
更重要的是.h文件是不同的版本
The one in the iPhone SDk dir was
iPhone SDk目录中的那个是
#define SQLITE_VERSION "3.7.2"
The one in the Mac /usr/include
Mac / usr / include中的那个
#define SQLITE_VERSION "3.7.5"
in /usr/include SQLITE_VERSION "3.7.5" the macro throwing the error is defined __OSX_AVAILABLE_BUT_DEPRECATED
在/ usr / include SQLITE_VERSION“3.7.5”中定义抛出错误的宏__OSX_AVAILABLE_BUT_DEPRECATED
SQLITE_API int sqlite3_enable_shared_cache(int) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_2_0, __IPHONE_5_0);
But In The one in the iPhone SDk 4.3 / sqlite "3.7.2"
但在iPhone SDk 4.3 / sqlite“3.7.2”中的那个
SQLITE_API int sqlite3_enable_shared_cache(int);
for same definition its not.
对于相同的定义,它不是。
the fix mentioned above works
上面提到的修复工作
CHANGE EVERY #include "/usr/include/sqlite3.h"
to
#include <sqlite3.h>
#3
0
Same problem here. I did read somewhere that upgrading to Xcode 4.2 may fix this bug. However, Xcode 4.2 is not currently an approved deployment tool for the App Store, so that's not an option.
同样的问题在这里我确实在某处读过升级到Xcode 4.2可以解决这个问题。但是,Xcode 4.2目前不是App Store的批准部署工具,因此不是一个选项。