How to build a C library for iOS by Xcode 6?

2019-01-28 22:02发布

问题:

I trying to build C library for iOS like the following picture.

I have build the liblib.a , but it compile error after I use liblib.a

The error log is like the following when I use liblib.a

file was built for archive which is not the architecture being linked (armv7): /Users/apk/Desktop/libTest/liblib.a
Undefined symbols for architecture armv7:

It seems the liblib.a not support for armv7, but I didn't find the armv7 and the arm64 in Build Setting -> Architectures.

How do I build the library of C code for armv7 and use in Objective-C ?

---------------------EDIT---------------------

After I change the setting like the following picture.

It has the .a file. But when I try to use this library , it also show

file was built for archive which is not the architecture being linked (armv7): /Users/apk/Desktop/libTest/liblib.a
Undefined symbols for architecture armv7: 

Did I missing something ?

---------------------EDIT2---------------------

I build the .a by following step.

1.Create new project.

2.Setting

3.

4.

5.put the C file and the .h file into project.

  1. Press the build button

Thanks in advance.

回答1:

You Want Creating library for ios see below picture for Architectures setting

Try this



回答2:

The Base SDK is set to "Latest OS X" not "Latest iOS".