如何引用dylib? [英] How do I reference a dylib?

查看:469
本文介绍了如何引用dylib?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序是用平台无关的C ++编写的,它主要是在Windows上开发的。我现在正试图让它在Mac上运行,但我似乎失去了如何链接到我正在使用的第三方库的Mac版本。我将库的include和lib文件夹分别添加到标题和库搜索路径,并编译/链接,但在运行时具有以下内容:

I have an application written in platform-independent C++ which has been primarily developed on Windows. I'm now trying to get it up and running on a Mac but I seem to be lost in how to link to the Mac version of a third-party library I'm using. I added the library's include and lib folders to header and library search paths respectively and it compiles/links but upon running dies with the following:

dyld :库未加载:@executable_path /../ Frameworks / libsfml-system-d.2.dylib
引用自:/ Users / jdoe / Library / Developer / Xcode / DerivedData / Foobar-fonhiddwdwvgqygcegiffqkontxi / Build / Debug / Foobar.app / Contents / MacOS / Foobar
原因:找不到图片

我可以让它运行dylibs在/ usr / lib,但我不认为这是一个好主意的分布。

I can get it to run by putting the dylibs in /usr/lib but I don't think this is a good idea for distribution. How can I include the dylib inside my app bundle?

推荐答案

添加复制文件构建阶段,将dylib复制到框架中文件夹。 (当您在复制文件构建阶段获取信息时,Frameworks是目标选择之一。)

Add a copy-files build phase that copies the dylib into the Frameworks folder inside the app bundle. (When you Get Info on a copy files build phase, Frameworks is one of the destination choices.)

这篇关于如何引用dylib?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆