How do I reference a dylib?

让人想犯罪 __ 提交于 2019-12-11 18:12:05

问题


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: 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. How can I include the dylib inside my app bundle?


回答1:


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.)



来源:https://stackoverflow.com/questions/7720312/how-do-i-reference-a-dylib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!