title: Search files in directory and subdirectory using boost library c++
body: <p>I want to create an application that search files in directory and in subdirectory using the boost library for c++ also I don't want to get trouble with UNICODE files like files named arabic .
  So how can i do that?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;boost/filesystem/operations.hpp&gt;
  #include &lt;boost/filesystem/fstream.hpp&gt;
  #define BOOST_FILESYSTEM_NO_DEPRECATED
  using namespace boost::filesystem;
  using namespace std;
  
  bool find_file( const path &amp; dir_path,         // in this directory,
                  const std::string &amp; file_name, // search for this name,
                  path &amp; path_found )            // placing path here if found
  {
    if ( !exists( dir_path ) ) return false;
    directory_iterator end_itr; // default construction yields past-the-end
    for ( directory_iterator itr( dir_path );
          itr != end_itr;
          ++itr )
    {
      if ( is_directory(itr-&gt;status()) )
      {
        if ( find_file( itr-&gt;path(), file_name, path_found ) ) return true;
      }
      else if ( itr-&gt;path().filename() == file_name ) // see below
      {
        path_found = itr-&gt;path();
        return true;
      }
    }
    return false;
  }
  
  int main()
  {
      path myPath = "C:";
      string myFile = ".doc";
      path myfound = "c:";
  
      find_file(myPath, myFile, myfound);
  }
  </code></pre>
  
  <p>I tried also this code but it won't compile it show this error and a lot</p>
  
  <pre><code>undefined reference to `boost::filesystem3::path::filename() const
  </code></pre>
  
  <p>also:</p>
  
  <pre><code>X:\mingw\boost\boost_1_47_0\boost\system\error_code.hpp|214|undefined reference to `boost::system::generic_category()'|
  </code></pre>