What steps

Discussion in 'Mac Programming' started by Miglu, Sep 2, 2010.

  1. macrumors member

    Joined:
    Jan 22, 2010
    #1
    How to make a C external library usable, besides adding it to the project folder?
     
  2. macrumors 604

    iShater

    Joined:
    Aug 13, 2002
    Location:
    Chicagoland
    #2
    What IDE, language are you using? In Java for example you have to have the library JAR file part of your CLASSPATH. We need more info. :)
     
  3. thread starter macrumors member

    Joined:
    Jan 22, 2010
    #3
    Objective-C.
     
  4. macrumors 6502

    Joined:
    Aug 10, 2008
    #4
    There really is no other way than adding it to your project. You would at the very least need the header definitions so you can use the functions but you would need a copy of the library when you create your object code.
     
  5. thread starter macrumors member

    Joined:
    Jan 22, 2010
    #5
    I meant what the steps in making it usable are, besides adding it to the project folder. I did it and added it to the frameworks folder in Xcode, but got several "symbol(s) not found" errors for methods in it. Then I added it to the Header Search Paths build configuration and still got the errors. Then I added it to the Other Linker Flags build configuration and still got the errors.
     
  6. macrumors 6502

    Joined:
    Aug 10, 2008
    #6
    I'm guessing its a pre-built library. The following link might be useful.
     
  7. thread starter macrumors member

    Joined:
    Jan 22, 2010
    #7
    That tutorial tells what I already tried. The library that I am trying to use is Chipmunk. I added it to the project folder and to the Xcode project. Then I added the word "chipmunk" to the Header Search Paths and "chipmunk/chipmunk.h" to the Other Linker Flags, but still got the errors.
     
  8. macrumors 6502

    Joined:
    Aug 10, 2008
    #8
    Just making sure, but did you add it as a pre-built library?
     
  9. macrumors 603

    Joined:
    Aug 9, 2009
    #9
    Post the complete error message text.

    Is the library compiled for the same architecture your program is compiled for?

    Is it a dynamic library or a static library?
     
  10. thread starter macrumors member

    Joined:
    Jan 22, 2010
    #10
    I do not know what a pre-built library is like, but I do not think that it is one.
    Code:
    Undefined symbols:
      "_cpInitChipmunk", referenced from:
          -[OpenGLView initWithFrame:] in OpenGLView.o
      "_cpBodyNew", referenced from:
          -[Ball2 init2] in Ball2.o
          -[Ball init1] in Ball.o
      "_cpSpaceNew", referenced from:
          -[OpenGLView initWithFrame:] in OpenGLView.o
      "_cpCircleShapeNew", referenced from:
          -[OpenGLView initWithFrame:] in OpenGLView.o
          -[OpenGLView initWithFrame:] in OpenGLView.o
      "_cpBodyUpdatePosition", referenced from:
          -[OpenGLView renderTimerCallback:] in OpenGLView.o
          -[OpenGLView renderTimerCallback:] in OpenGLView.o
      "_cpSpaceAddBody", referenced from:
          -[OpenGLView initWithFrame:] in OpenGLView.o
          -[OpenGLView initWithFrame:] in OpenGLView.o
      "_cpResetShapeIdCounter", referenced from:
          -[OpenGLView initWithFrame:] in OpenGLView.o
      "_cpSpaceAddShape", referenced from:
          -[OpenGLView initWithFrame:] in OpenGLView.o
          -[OpenGLView initWithFrame:] in OpenGLView.o
      "_cpBodyUpdateVelocity", referenced from:
          -[OpenGLView renderTimerCallback:] in OpenGLView.o
          -[OpenGLView renderTimerCallback:] in OpenGLView.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
     

Share This Page