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

2019-01-28 21:40发布

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

enter image description here

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.

enter image description here

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.

enter image description here

2.Setting

enter image description here

3.enter image description here

4.enter image description here

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

  1. Press the build button

Thanks in advance.

2条回答
疯言疯语
2楼-- · 2019-01-28 22:19

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

查看更多
不美不萌又怎样
3楼-- · 2019-01-28 22:28

enter image description hereYou Want Creating library for ios see below picture for Architectures setting enter image description here

Try this

Next helpful image

查看更多
登录 后发表回答