MAC OSX dylib 以及如何使用它们
我在 Mac OSX (Lion) 上下载并安装了(我认为)gtk。在所有 -I 正确后,测试程序的编译顺利进行。现在链接失效了。通过 grep 查找丢失的入口点,
_gtk_init
_gtk_window_new
... 11 more
发现它们位于 /Users/ccpalmer/gtk/inst/lib/libgtk-quartz-2.0.0.dylib /Users/ccpalmer/gtk/inst/lib/libgtk-quartz-2.0.dylib
由于不太熟悉 OSX 的底层 Unix,我不确定如何完成链接步骤。我必须承认,我以前从未遇到过“dylib”。
有没有 OSX 开发专家可以解开我的谜团?
查尔斯
I downloaded and installed (I think) gtk on the Mac OSX (Lion). Compilation of test program went fine after getting all the -I's correct. Now the link is failing. A grep for the missing entrypoints
_gtk_init
_gtk_window_new
... 11 more
found them in
/Users/ccpalmer/gtk/inst/lib/libgtk-quartz-2.0.0.dylib
/Users/ccpalmer/gtk/inst/lib/libgtk-quartz-2.0.dylib
Being less familiar with OSX's underlying Unix, I'm not sure how to get thru the link step. I must admit, I've never encountered a "dylib" before.
Are there any OSX dev smarties out there who might shed some light on my mystery?
Charles
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如 moshbear 上面评论的那样,
dylib
文件是共享库在 Mac OS X 上的打包方式。要使用这样的共享库,您需要向编译器传递两个开关,-L
和-l
。第一个将包含 dylib 的目录添加到链接器的库搜索路径中,第二个指定要链接的库。对于位于/usr/mylibs
中的虚构的libfoo.dylib
来说,类似这样的事情:As moshbear commented above,
dylib
files are how shared libraries are packaged on Mac OS X. To use such a shared library, you need to pass two switches to your compiler,-L
and-l
. The first adds the directory containing yourdylib
to the linker's library search path, and the second specifies the library to link against. Something like this, for a fictionallibfoo.dylib
that lives in/usr/mylibs
: