Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Miglu

macrumors member
Original poster
Jan 22, 2010
74
0
How to make a C external library usable, besides adding it to the project folder?
 

iShater

macrumors 604
Aug 13, 2002
7,025
464
Chicagoland
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. :)
 

mrbash

macrumors 6502
Aug 10, 2008
251
1
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.
 

Miglu

macrumors member
Original poster
Jan 22, 2010
74
0
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.
 

Miglu

macrumors member
Original poster
Jan 22, 2010
74
0
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.
 

chown33

Moderator
Staff member
Aug 9, 2009
10,706
8,345
A sea of green
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?
 

Miglu

macrumors member
Original poster
Jan 22, 2010
74
0
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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.