Я новичок в C ++ Boost. Может ли кто-нибудь здесь помочь мне отладить эту программу.
#include <iostream>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/fstream.hpp>
using namespace boost::filesystem;
using namespace std;
void show_files( const path & directory, bool recurse_into_subdirs = true )
{
if( exists( directory ) )
{
directory_iterator end ;
for( directory_iterator iter(directory) ; iter != end ; ++iter )
if ( is_directory( *iter ) )
{
cout << iter->native_directory_string() << " (directory)\n" ;
if( recurse_into_subdirs ) show_files(*iter) ;
}
else
cout << iter->native_file_string() << " (file)\n" ;
}
}
int main()
{
show_files( "." ) ;
}
Когда я пытаюсь запустить эту программу, я получаю сообщение об ошибке типа
ex2.cpp: In function ‘void show_files(const boost::filesystem2::path&, bool)’:
ex2.cpp:15: error: ‘class boost::filesystem2::basic_directory_entry<boost::filesystem2::basic_path<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::filesystem2::path_traits> >’ has no member named ‘native_directory_string’
ex2.cpp:19: error: ‘class boost::filesystem2::basic_directory_entry<boost::filesystem2::basic_path<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::filesystem2::path_traits> >’ has no member named ‘native_file_string’
Тэнкс заранее. Постскриптум Эта программа перечислит все файлы / папки