简体   繁体   中英

Linking C libraries in Xcode iOS

I built C code separately and have libperson.a output. I want to include this library into my xcode project. Added this .a under “Link Binary with Libraries” to my project.

#import "person.h"

It can't find the person.h. What am I doing wrong?

You also need to add the header file(s) to you project. Or, if the headers are better off somewhere else, you need to add a Header Search Path to your Xcode target's Build Settings; in that way Xcode can find them.

Coming from Java: C has header files in which you typically declare public interfaces of a matching source file. Where in Java you have import after which the compiler sorts it all out for you from the binaries , in C you need to #include the public definitions as header at the source file level .

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