2

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.

Martin
  • 2,813
  • 11
  • 43
  • 66

2 Answers2

3

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

Try this

Next helpful image

Jaffer Wilson
  • 7,029
  • 10
  • 62
  • 139
srinivas n
  • 640
  • 4
  • 20
  • I have change the setting and it has `.a file`, but it show the following error when I use the library. `file was built for archive which is not the architecture being linked (armv7): /Users/apk/Desktop/libTest/liblib.a Undefined symbols for architecture armv7:` – Martin Nov 06 '14 at 11:32
  • your are yousing .a file another project ! that time this error is came ? – srinivas n Nov 06 '14 at 11:35
  • I create a new project and use the .a library , it show the `file was built for archive which is not the architecture being linked (armv7):` – Martin Nov 06 '14 at 11:37
  • Which way you have creating the .a file means through script or lipo statement – srinivas n Nov 06 '14 at 11:42
  • You are taking OSX category Framework , Take the ios category Framework – srinivas n Nov 06 '14 at 11:56
  • It build success , but it didn't show any `.a file`. – Martin Nov 07 '14 at 01:39
  • I am checking its creating build please cross check the , Project & Target settings as same as above images – srinivas n Nov 07 '14 at 04:07
0

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

Jeffery Thomas
  • 42,202
  • 8
  • 92
  • 117
  • I have change the setting , but it show the following error when I use the library. `file was built for archive which is not the architecture being linked (armv7): /Users/apk/Desktop/libTest/liblib.a Undefined symbols for architecture armv7:` – Martin Nov 06 '14 at 11:31