title: Mac linking dynamic library (boost -image not found)
body: <p>Im developing C++ application using xcode. And i built boost C++ successfully. overcome the Error image not found. I have first verified my dynamic libraries not having the path where these are located in.(i used otool -L) in oder to overcome it i followed <a href="https://stackoverflow.com/questions/8902420/how-can-i-get-xcode-to-link-and-debug-an-app-with-boost-filesystem">This Link</a> Please find below the steps i used </p>
  
  <p><strong>fyp</strong> is my xcode project executable (exec)</p>
  
  <ol>
  <li><p>First i gave path to libboost_filesystem.dylib to do that i used</p>
  
  <p><strong>install_name_tool -change libboost_filesystem.dylib /usr/local/lib/a/lib/libboost_filesystem.dylib fyp</strong></p></li>
  <li><p>I varified it by using </p></li>
  </ol>
  
  <p><strong>otool -L fyp | grep libboost_filesystem.dylib</strong></p>
  
  <pre><code>**out put**-/usr/local/lib/a/lib/libboost_filesystem.dylib (compatibility version 0.0.0, current version 0.0.0)
  </code></pre>
  
  <ol start="3">
  <li><p>And i link libboost_system.dylib into libboost_filesystem.dylib to do that i used </p>
  
  <p><strong>install_name_tool -change libboost_system.dylib /usr/local/lib/a/lib/libboost_system.dylib /usr/local/lib/a/lib/libboost_filesystem.dylib</strong></p></li>
  <li><p>I tried again otool -L fyp | grep libboost_filesystem.dylib</p></li>
  </ol>
  
  <p><strong>libboost_filesystem.dylib (compatibility version 0.0.0, current version 0.0.0)</strong></p>
  
  <p>The Path i gave in step 1 is gone. Now im having the same error.which is </p>
  
  <pre><code>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
  </code></pre>
  
  <p>how do i overocome this issue and work with this dynamic libararies. Any advance is appriated.</p>
  
  <p><img src="https://i.stack.imgur.com/P6NjC.png" alt="Terminal"></p>
  
  <p>In oder to do that i used bash script . But again i'm getting the error</p>
  
  <pre><code>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
  </code></pre>
  
  <p>The bash script </p>
  
  <pre><code> 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
  </code></pre>