On Wed, Jul 20, 2011 at 06:12:14AM -0700, Eric Lin wrote:
Dear advanced boost/c/g++ programers:
I copied and try a simple (Reading a directory with boost) program , from page 383, Example 10-19, of book(C++ cookbook) Example10-19.cpp:34:24: error: ‘class boost::filesystem3::directory_entry’ has no member named ‘leaf’
I am using 1.46.1 of boost
Note that the error message mentions "filesystem3", which indicate that you are currently using Boost.Filesystem v3. The book is probably written against the old Filesystem v2, which was the default version used up through Boost 1.45.0. You've got two solutions at hand: 1) Define the preprocessor definition shown in the documentation to get v2, but that will stop working when Boost stops shipping v2 (according to the docs, this will be after 1.47). 2) Rewrite the code to use the slightly different interface of v3. http://www.boost.org/doc/libs/1_47_0/libs/filesystem/v3/doc/index.htm -- Lars Viklund | zao@acc.umu.se