CHDataStructures.framework won't compile for i

2020-04-12 09:18发布

问题:

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. ;-)