4

I'm trying to build a .dylib in Xcode. Currently the .dylib builds, but when I drag the .dylib into another project and try to #import one of the headers (Seeker.h) in the .dylib, I get this error:

*: No such file or directory
Seeker.h: No such file or directory

The project is available as an Xcode project here.

I can confirm the header is indeed in a path alongside the .dylib once built, but as for what to do with it I have no idea. My only experience with .dylib files is frameworks built into Mac OS X, like libsqlite3.dylib, which works perfectly. All the tutorials I can find on .dylib files does not cover how to use them with Xcode in a sensible manner; all of them rely either on complex scripts or machine-dependent configuration which will not work for us.

So basically I need a start-to-finish step-by-step process that successfully builds the .dylib and successfully includes it in another Xcode project in a way that's not dependent on changing build settings for different users. In other words, a way that just works and that will work when we distribute both projects to members of our team.

jstm88
  • 3,335
  • 4
  • 38
  • 55

2 Answers2

5

Dylibs don't carry headers: they're brainless executable files. Built-in libraries have their headers in known locations, like /usr/include, which makes them globally available. What you're looking for is probably a framework.

Frameworks are packages that contain a dynamic library and header files, so once you link with the framework you can import the headers it has. It can also carry other resources such as images and sounds.

I suggest you read the Framework Programming Guide for more informations.

zneak
  • 134,922
  • 42
  • 253
  • 328
  • Well, now I've created the framework and everything's crazy... I built it in Xcode 4 but it won't work in either 3 or 4; I recreated it in 3 using a new project and it won't work in 3 but it'll work in 4... ugh. I've actually had [problems with frameworks before](http://cl.ly/2rcS) that were never resolved. WHY are there no good framework tutorials that actually work? We'll probably never know... in any case, now I'm stuck with NO functioning framework OR dylib... – jstm88 Oct 18 '10 at 03:55
  • I did create a quick demo of the issue available [here](http://cl.ly/2s6B) - this one has some major issues that I can't figure out. If someone can just figure out how to get that working, it would be a big help... – jstm88 Oct 18 '10 at 03:58
  • Well, now I have this issue: http://cl.ly/2sDe I've uploaded a copy of the test project [here](http://cl.ly/2rlW). Basically everything seems to be working (headers and all) but the Image Not Found error comes up. I've used a few frameworks (and had the header issues) but I never saw this one before... – jstm88 Oct 18 '10 at 04:54
  • Okay, I've got the important one [working](http://cl.ly/2s3L) (!) but I still want to know what's going on with that sample project with the Image Not Found error, especially since it should be working. Also, if you're interested in what this actually is, here's the [project](http://cl.ly/2rsL) on SourceForge, though nothing's uploaded yet. Basically it's an object oriented SQLite wrapper written in C++. – jstm88 Oct 18 '10 at 05:39
  • I know this is an old post... did you manage to use libVlc in Xcode? Do you have a sample project? – Pier Mar 03 '12 at 02:11
  • @Pier, I have never attempted to use `libVlc` in Xcode. If you are running into issues with `#include` directives, double-check that the include path contains the path to the `libVlc` headers. – zneak Mar 04 '12 at 23:07
0

You are not able to create static library .dylib from Xcode because they are using OS, but you are able to create a dynamic framework with .dylib inside

[iOS static vs dynamic library]

[Create dynamic framework]

yoAlex5
  • 29,217
  • 8
  • 193
  • 205