title: C++ BOOST undefined reference to `boost::filesystem::detail::copy_file
body: <p>I have no clue why <code>boost::filesystem::copy_file</code> is making trouble for me.</p>
  
  <blockquote>
    <p>undefined reference to `boost::filesystem::detail::copy_file</p>
  </blockquote>
  
  <pre><code>// g++ -std=c++11 test.cpp -lboost_filesystem -lboost_system -lrt -lboost_wave
  
  #include &lt;boost/filesystem.hpp&gt;
  
  int main()
  {
  
      boost::filesystem::create_directory("aaa");
      // ok
  
  
      boost::filesystem::copy_file("f1","f2");
      // /tmp/ccNWZltB.o: In function `boost::filesystem::copy_file(boost::filesystem::path const&amp;, boost::filesystem::path const&amp;)':
      // test.cpp:(.text._ZN5boost10filesystem9copy_fileERKNS0_4pathES3_[_ZN5boost10filesystem9copy_fileERKNS0_4pathES3_]+0x26): undefined reference to `boost::filesystem::detail::copy_file(boost::filesystem::path const&amp;, boost::filesystem::path const&amp;, boost::filesystem::copy_option, boost::system::error_code*)'
      // collect2: error: ld returned 1 exit status
  
  
      return 0;
  }
  </code></pre>
  
  <p>I got no inspiration from the source code of boost or its <a href="http://www.boost.org/doc/libs/1_60_0/libs/filesystem/doc/reference.html#copy_file">help</a>:</p>
  
  <pre><code>  inline
    void copy_file(const path&amp; from, const path&amp; to,   // See ticket #2925
                   BOOST_SCOPED_ENUM(copy_option) option, system::error_code&amp; ec)
                                         {detail::copy_file(from, to, option, &amp;ec);}
  </code></pre>
  
  <p>Even such a <a href="http://www.richelbilderbeek.nl/CppBoostCopy_file.htm">simple example</a> does not work for me.</p>
  
  <p>Platform: <code>Linux Ubuntu 64</code></p>