我在XCode上开发了一个项目,其中我添加了一些dylib。当使用XCode启动时,该项目可以很好地编译和执行。
但是当我尝试在我的shell中启动它时,我得到了lib错误:
iMac-de-Remi-Doolaeghe:MacOS remidoolaeghe$ ./Adobe\ InDesign\ CS5
2011-12-16 10:08:55.160 Adobe InDesign CS5[8071:903] Error loading /Applications/Adobe InDesign CS5/Plug-Ins/Autocat/Autocat.InDesignPlugin/Autocat: dlopen(/Applications/Adobe InDesign CS5/Plug-Ins/Autocat/Autocat.InDesignPlugin/Autocat, 265): Library not loaded: libboost_filesystem-xgcc42-mt-1_37.dylib
Referenced from: /Applications/Adobe InDesign CS5/Plug-Ins/Autocat/Autocat.InDesignPlugin/Autocat
Reason: image not found
2011-12-16 10:08:55.161 Adobe InDesign CS5[8071:903] Error loading /Applications/Adobe InDesign CS5/Plug-Ins/Autocat/AutocatUI.InDesignPlugin/AutocatUI: dlopen(/Applications/Adobe InDesign CS5/Plug-Ins/Autocat/AutocatUI.InDesignPlugin/AutocatUI, 265): Library not loaded: libboost_filesystem-xgcc42-mt-1_37.dylib
Referenced from: /Applications/Adobe InDesign CS5/Plug-Ins/Autocat/AutocatUI.InDesignPlugin/AutocatUI
Reason: image not found
Bus error
我可以通过复制usr/lib文件夹中的库来解决这个错误。这在我的帖子上是可以的。但在分发它时,这是不好的。我想我的链接器在我的XCode项目中做错了什么,但是看不到是什么。
我使用的是XCode 3.2.6。库存在于我的目标中,在"Link Binary With Libraries“下,以及在"Libraries”文件夹中的Groups&Files下
我不确定这是否重要,但我的项目是一个用于InDesign的插件。
提前谢谢。
发布于 2012-01-24 21:11:20
我说的是错误的,但如果它是一个动态库,你也必须在它被分发到的机器上有那个动态库。您可能会对将动态库打包到安装向导中或其他什么东西感兴趣。
但是,如果它是一个静态库,您可以通过使用以下标志之一强制包含所有符号:
-Obj-C
-all_load
-force_load
有关这些标志的用途以及如何使用它们的详细说明,可以在这里找到:Objective-C categories in static library
https://stackoverflow.com/questions/8533700
复制相似问题