I have a static C library compiled with arm7-gcc and i want to use it in my iOS project. i added it to project but i can't figure out how to use it.
Asked
Active
Viewed 4,579 times
4
-
Have you linked it in the "Link Binary With Libraries" section? – Popeye Aug 06 '12 at 14:43
-
Using a library usually entails two things - being able to include its headers, and being able to link to its binaries. Which one is not working for you? – Sergey Kalinichenko Aug 06 '12 at 14:51
-
I addaed .a file to project, then i checked "Link Binary With Libraries" section and it was there already. I can build the application without any linker warnings but i don't know how to use it. – kavalerov Aug 06 '12 at 14:56
-
Include the header file in the implementation file where you are going to be using the library API calls. Use the API as normal. The linker will take care of the rest. – David G Aug 06 '12 at 15:12
-
i mean - do i just write #include
? – kavalerov Aug 06 '12 at 17:35 -
@jww No dupe. Static library and framework are different. Though the procedures are same, but this question is dealing with something different. – eonil Jul 03 '14 at 06:09
-
@Eonil - you're probably right. I don't think flybirdx understands they are essentially the same question with the same answers. This one probably should have been closed as "too broad" since it appears he does not know C/C++/Obj C programming or Xcode. – jww Jul 03 '14 at 06:23
-
@jww I agree that this question is too broad. Anyway comments and answer are clearing the question, and I don't think this question need to be closed unless this is duplicated with another question. – eonil Jul 03 '14 at 06:26
-
This question is way more specific than the one it is declared duplicate as. A framework is way more general than a `.a` file (specific library type). This is a joke. The duplicate question don't even specify the programming laungage.This question is also about using the library - not only adding it – Lealo Jan 18 '18 at 21:28
1 Answers
2
After adding the library to the project and including the header in your application codeб there is a second step. That step is letting the Xcode project know where the header file/files is/are. You do this by editing the "User Header Search Paths" build setting with the path to the header files.

arrowd
- 33,231
- 8
- 79
- 110

Tom Wetmore
- 233
- 1
- 6
-
An alternative way to let Xcode know about the path to the header files is to add the headers to the project. – ThomasW Oct 06 '12 at 11:04
-
Yes, adding them to the project works well. If you do, I recommend you don't select the option of copying when adding. If you do Xcode will make duplicate copies which can lead to update problems in the future. I prefer not to add them to my project because most libraries are so self-contained that there is rarely a need to refer to their header files. – Tom Wetmore Oct 06 '12 at 17:42
-
"project and including the header in your application". I only have `.a` file. Does that mean I am unable to use the library file. Can you create the header - if so how? – Lealo Jan 18 '18 at 21:27