简体   繁体   English

我如何引用dylib?

[英]How do I reference a dylib?

I have an application written in platform-independent C++ which has been primarily developed on Windows. 我有一个使用平台无关的C ++编写的应用程序,该应用程序主要在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. 我现在正在尝试在Mac上启动并运行它,但是我似乎迷失在如何链接到我正在使用的Mac版本的第三方库上。 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: 我分别将库的include和lib文件夹添加到标头和库搜索路径中,并且它可以编译/链接,但是在运行时死于以下内容:

dyld: Library not loaded: @executable_path/../Frameworks/libsfml-system-d.2.dylib Referenced from: /Users/jdoe/Library/Developer/Xcode/DerivedData/Foobar-fonhiddwdwvgqygcegiffqkontxi/Build/Products/Debug/Foobar.app/Contents/MacOS/Foobar Reason: image not found

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. 我可以通过将dylib放在/ usr / lib中来使其运行,但是我认为这不是发行的好主意。 How can I include the dylib inside my app bundle? 如何在我的应用程序包中包含dylib?

Add a copy-files build phase that copies the dylib into the Frameworks folder inside the app bundle. 添加一个复制文件构建阶段,该阶段将dylib复制到应用程序捆绑包内的Frameworks文件夹中。 (When you Get Info on a copy files build phase, Frameworks is one of the destination choices.) (当您获取有关复制文件构建阶段的信息时,Framework是目标选择之一。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM