title: How to statically link boost_filesystem using command line
body: <p>Hi a am learning boostfilesystem.I have a testcode and i have build it using command - </p>
  
  <p>g++ -std=c++11 -I//Boost_Test/boost_1_63_0/installation/include  -L/Boost_Test/boost_1_63_0/installation/lib/ test.cpp -Bstatic  -lboost_filesystem -lboost_system</p>
  
  <p>But when i run it using command</p>
  
  <p>./a.out </p>
  
  <p>i get the error as -  dyld: Library not loaded: libboost_filesystem.dylib
    Referenced from: /Users/Abc/Obj/./a.out
    Reason: image not found</p>
  
  <p>But when i run it like -</p>
  
  <p>DYLD_LIBRARY_PATH=/Boost_Test/boost_1_63_0/installation/lib ./a.out</p>
  
  <p>it is working.</p>
  
  <p>My Question is if i have linked it statically using -Bstatic option why it is not linked statically.Why i have to give shared library path to run it.</p>