views:

614

answers:

2

Hi,

In am developing one application for iphone, where I want to integrate third party API's with my application. I have two .h files and one .a files. The header files contains some method and I want to invoked that method into my application. I set the header search path and library search path. Then I tried to invoked the method into my application but it's giving error as "method name:referenced from". I am stucked. I cant able to understand how to deal with this problem. So I can invoked the method into my application. If anyone knows it. Please reply me as soon as possible

A: 

You will need to have the source code of the library you are trying to integrate with. Remember: iPhone is ARM-BASED and your .a is probably compiled to work with Intel.

I have successfully integrated iPhone apps with libraries written in C and C++. You only need to add the sources to the XCode project and you are done.

Good luck.

Pablo Santa Cruz
I have added them into XCode project through add project. I just have two .h files that contain only declaration of methods and .a file contain executable code of methods. When I build the application it gives same error.
Jyotsna
As I stated in my post, I don't think it will work with the **.a** file, since it's probably compiled to work with Intel (iPhone is *ARM*) instructions. Try adding the source files of your library.
Pablo Santa Cruz
Third party only gives me two header files which contain method declaration. I don't exactly understand source files means which file I need to add. Now because I have Only this many files. And that third party have there own SDK so I don't know there source file also.
Jyotsna
OK. By source files I meant ".cpp" files. The one containing not your method declarations (".h") but your method definitions. If you don't have those, you will have to ask third party to compile the library ".a" file specifically for iPhone.
Pablo Santa Cruz
Can you run the command "otool -tV filename.a" and paste a few lines of output over here so we can tell if your library is ARM code or Intel code?
sigjuice
Thank you very much for your response I will checked it and let you know.
Jyotsna
i sigjuice I tried to extract my ".a" by " macdesk06:Developer mac4$ otool -tV ThirdAPI.a". But it gives error as "ThirdAPI.a: is not an object file"
Jyotsna
What do the commands "file ThirdAPI.a" or "ar t ThirdAPI.a" say?
sigjuice