views:

195

answers:

3

Hi to all

In my iphone game I want to add external .h and .a files. I am adding them by using add project option given in Xcode. It get added but I want to invoked the methods given in the header files. As per instruction given to us we have to call one method which is declared in external header file. We have to call that method inside AppDelegate's applicationDidFinishLaunching method . But at the time of compilation it gives one error that is referenced from: and symbol not found. I don't understand how to invoked this method and how to get referenced for the method.

I am sending one link please see that. The same problem with my application is coming.

http://forums.macrumors.com/showthread.php?t=443437

In that three screen shots are given by some toddburch on Jan 24, 2009, 07:37 AM The same error for my methods are also coming but my code is in Cocoa with objective-c not in ruby.

If anyone know the solution please reply me As soon as possible.

+1  A: 

The .h is not enough. You also need the implementation, either source code or compiled framework.

mouviciel
I have one .a file and two .h files but I don't understand how to invoked there methods. Because I don't have implementation files.
Jyotsna
The .a file is an archive. It contains executable code for your methods. I am not sure how to integrate it to your project, though I suspect adding it to the group of frameworks should be ok.
mouviciel
Ya I have added that .a file into framework only but the methods which are in .h still not getting reference. Thank you for your guidance.
Jyotsna
A: 

Do you have access to the source code itself? Try dragging the .h and .m/.c files from the framework directory directly into your project. It's a little messy, but I think it will solve your problem based on the error messages you are getting. You can put them all in a group so your project doesn't look so crowded after you drag them over if you like.

Tim Bowen
A: 

You currently have two files

  • A *.h header file which describes the classes and functions available in your third party library
  • A *.a static library file which holds the pre-compiled code for the functions described by the *.h file.

Assuming you've got to the stage where you can #include or #import "xyz.h" and compile your application, the bit which is missing is linking your executable with the *.a file.

The symbol not found error message is the linker telling you it knows some of your code is calling a particular function, but it can't currently find another code module that provides an implementation of that function.

One thing to check is that your *.a file is correctly configured within your project to be passed to the linker. One way to do this is to expand the "Targets" section of the main XCode window. If you drill down into the section representing your application you should see a subnode labeled "Link Binaries with Libraries". Your *.a file should be listed, if it isn't one way to add it is to simple drag and drop the file into this section.

Christopher Fairbairn