简体   繁体   中英

Linking trouble in xcode 4

I'm new to the world of iOS programming and MacOS at all, and this question is built terribly, but still. I'm learning all this for a month. Till now i didn't have to ask questions anywhere because I could find answers using google. But now I'm trying to migrate from usual Obj-C to Obj-C++. My teacher gave me some library to include and it had #include "libkern/OSAtomic.h" . First build failed and wrote that there was no OSAtomic found. I figured that I needed to include Kernel.framework to my project. But when I did that there was another error, something like it couldn't find kernel or something. Sorry for this spontaneous question, I'm not at my mac right now, but if someone had something like that - he could answer question and help me right away. Else - i'll post exact error when I'll be at my mac.

Error is: ld: framework not found Kernel Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang++ failed with exit code 1

UPD Problem solved. This include (which was in angle brackets already, btw), was included after all. Kernel framework was not only unnecessary, but harmful - it supposedly made app build for MacOS instead of iOS. I removed Kernel.framework and found which methods linker had problem with and with a few google magic it was found out that Security.framework was needed. Program builded successfully after that.

Thank you everybody for your responses.

I don't think you want the Kernel.framework, as that's used only for kernel extension development - so remove that dependency again. Instead, I suspect you need to install XCode's command-line/UNIX stuff, which will install a file /usr/include/libkern/OSAtomic.h which the compiler should be able to find without any framework references. You can download extra packages via XCode -> Preferences... (⌘,) -> Downloads.

I found a solution to this also, that is different.

You can just include it with

#import <libkern/OSAtomic.h>

This is with Xcode 5.0.2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM