Reputation: 6979
I am trying to iterate over the directory and print the name of all the files starting from the root.
Here's the short snippet I have written using Boost::Filesystem
(1.52.0) in my program.
void testApp::getNames(const string& dirPath, string& fileExtension)
{
namespace fs = boost::filesystem;
namespace sys = boost::system;
fs::path filePath(dirPath);
for(fs::recursive_directory_iterator dir(filePath), dir_end; dir!=dir_end ;++dir)
{
cout<<*dir;
}
}
On trying the compile this, strangely I am getting build errors which points path.hpp
file on the following snippet:
static const codecvt_type& codecvt()
{
return *wchar_t_codecvt_facet();
}
The error that I get is undefined reference to boost::filesystem3::path::wchar_t_codecvt_facet()'|
I am on Ubuntu 12.10 using Codeblocks IDE for my project.
Upvotes: 0
Views: 602
Reputation: 409146
That is a linker error. You need to link with the Boost filesystem library.
In the IDE, there should be a setting for adding libraries somewhere in the project settings. (I don't know exactly where, since I've never used Codeblocks.)
Upvotes: 2