我正在使用xcode开发C ++应用程序。我成功地构建了boost C ++。克服未找到的错误图像。我首先验证了我的动态库没有它们所在的路径。(我使用otool -L)以便克服它我跟着This Link请在下面找到我使用的步骤
fyp 是我的xcode项目可执行文件(exec)
首先我给了libboost_filesystem.dylib的路径来做我用过的
install_name_tool -change libboost_filesystem.dylib /usr/local/lib/a/lib/libboost_filesystem.dylib fyp
我使用
otool -L fyp | grep libboost_filesystem.dylib
**out put**-/usr/local/lib/a/lib/libboost_filesystem.dylib (compatibility version 0.0.0, current version 0.0.0)
我将libboost_system.dylib链接到libboost_filesystem.dylib以执行我使用的
install_name_tool -change libboost_system.dylib /usr/local/lib/a/lib/libboost_system.dylib /usr/local/lib/a/lib/libboost_filesystem.dylib
我再次尝试了otool -L fyp | grep libboost_filesystem.dylib
libboost_filesystem.dylib(兼容版本0.0.0,当前版本0.0.0)
我在步骤1中给出的路径已经消失。现在我有同样的错误。这是
dyld: Library not loaded: libboost_filesystem.dylib
Referenced from: /Users/venushka/Library/Developer/Xcode/DerivedData/fyp-hdmbzawysyuciselqwbvjgjuhxbo/Build/Products/Debug/fyp
Reason: image not found
我如何过度使用此问题并使用此动态库。任何进步都是适用的。
为了做到这一点,我使用了bash脚本。但我又得到了错误
dyld: Library not loaded: libboost_filesystem.dylib
Referenced from: /Users/venushka/Library/Developer/Xcode/DerivedData/fyp-hdmbzawysyuciselqwbvjgjuhxbo/Build/Products/Debug/fyp
Reason: image not found
bash脚本
install_name_tool -change libboost_filesystem.dylib $executable_path/libboost_filesystem.dylib $FYP_PATH/fyp
install_name_tool -change libboost_system.dylib $executable_path/libboost_system.dylib $FYP_PATH/fyp
install_name_tool -change libboost_thread.dylib $executable_path/libboost_thread.dylib $FYP_PATH/fyp
install_name_tool -change libboost_regex.dylib $executable_path/libboost_regex.dylib $FYP_PATH/fyp
install_name_tool -change libboost_log.dylib $executable_path/libboost_log.dylib $FYP_PATH/fyp
install_name_tool -change libboost_timer.dylib $executable_path/libboost_timer.dylib $FYP_PATH/fyp
install_name_tool -change libboost_thread.dylib $executable_path/libboost_thread.dylib $executable_path/libboost_system.dylib
install_name_tool -change libboost_system.dylib $executable_path/libboost_system.dylib $executable_path/libboost_filesystem.dylib