title: How do I link boost to my program?
body: <p>I downloaded Boost 1.54 and ran <code>bootstrap.bat mingw</code>.  Then I tried to run the program below. I am getting the error you see below.  I have tried copying my boost folder into the mingw include folder and I have tried linking my file to the <code>boost/stage/lib</code> folder, but I have not been successful.  I see a lot of questions similar to this question, but none of them explain how to get the link the boost folder to the file.  </p>
  
  <p>Do I have to copy the boost folder to a different directory?  Do I have to change my path variable? How can I get the boost library to link to my code?</p>
  
  <h1>Code</h1>
  
  <pre><code>#include &lt;boost/filesystem.hpp&gt;   
  #include &lt;iostream&gt;              
  
  using namespace std; 
  using namespace boost::filesystem;
  
  int main()
  {
      boost::filesystem::directory_iterator iterator(string("."));
      for(; iterator != boost::filesystem::directory_iterator(); ++iterator)
      {
          cout &lt;&lt; (iterator-&gt;path().filename()) &lt;&lt; endl;
      }
  
      boost::filesystem::path full_path( boost::filesystem::current_path() );
      std::cout &lt;&lt; "Current path is : " &lt;&lt; full_path &lt;&lt; std::endl;
     return 0;
  
  }
  </code></pre>
  
  <h1>Error</h1>
  
  <pre><code>C:\Users\212340~1\AppData\Local\Temp\ccZA7umT.o:playground.cc:(.text+0xa4): undefined reference to `boost::filesystem::path::filename() const'
  C:\Users\212340~1\AppData\Local\Temp\ccZA7umT.o:playground.cc:(.text+0x244): undefined reference to `boost::system::generic_category()'
  C:\Users\212340~1\AppData\Local\Temp\ccZA7umT.o:playground.cc:(.text+0x24e): undefined reference to `boost::system::generic_category()'
  C:\Users\212340~1\AppData\Local\Temp\ccZA7umT.o:playground.cc:(.text+0x258): undefined reference to `boost::system::system_category()'
  c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: C:\Users\212340~1\AppData\Local\Temp\ccZA7umT.o: bad reloc address 0x1b in section `.text$_ZNK5boost6system10error_code7messageEv[__ZNK5boost6system10error_code7messageEv]'
  collect2.exe: error: ld returned 1 exit status
  [Finished in 21.0s with exit code 1]
  </code></pre>