CHDataStructures.framework won't compile for iOS in Xcode 4

一世执手 提交于 2019-12-31 01:59:46

问题


I downloaded CHDataStructures source code (r709), and tried to compile the iOS static library under xCode 4. It complained when compiling:

Can anyone give me some ideas how to compile it?


回答1:


As the author of the framework, I was intrigued when Dave DeLong passed this link my way.

Turns out this isn't due to Xcode 4, it's due to changes in the iOS 4.3 SDK (and incidentally, the 10.7 SDK too). I was using the OBJC_EXPORT macro with __attribute__((visibility("hidden"))) (for which I defined a macro called HIDDEN). This wasn't a problem until 4.3/10.7 changed the definition of OBJC_EXPORT macro in /usr/include/objc/objc-api.h...

Previously, it was defined as OBJC_EXTERN, but now it's defined as OBJC_EXTERN OBJC_VISIBLE, which resolves to OBJC_EXTERN __attribute__((visibility("default"))). Thus, my declarations that used HIDDEN OBJC_EXPORT suddenly began resolving to:

__attribute__((visibility("hidden"))) OBJC_EXTERN __attribute__((visibility("default")))

Basically, the opposing visibility attributes were the cause of the errors. (Ready, fight!)

I've just tested and committed a fix which replaces HIDDEN OBJC_EXPORT with HIDDEN. Apparently those symbols didn't need to be declared as extern anyway, because it works without those macros.

So, the short answer to your question is: update to revision 710. ;-)



来源:https://stackoverflow.com/questions/5418832/chdatastructures-framework-wont-compile-for-ios-in-xcode-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!