mad
mad

Reputation: 2789

Problems compiling C++ code with boost library

I am trying to compile the (thomas pevny's source code to calculate the subtractive pixels adjacency matrix). This code asks to previously install the libboost and libpng library, which i done successfully.

but when I do the 'make' command, the following errors appears on the terminal.

spam.cpp:169:26: error: ‘class boost::filesystem3::directory_entry’ has no member named ‘leaf’
spam.cpp:179:20: error: ‘class boost::filesystem3::path’ has no member named ‘native_file_string

Is there a way to fix this problem? Should I install another libboost version?

thanks for your attention.

Upvotes: 5

Views: 6213

Answers (3)

mad
mad

Reputation: 2789

The problem was solved with @Salgar and @Jean-Baptiste Yunès suggestions and also by adding -lboost_system after -lboost_filesystem in makefile. Thank you everybody.

Upvotes: 0

Salgar
Salgar

Reputation: 7775

leaf() is deprecated.

See this list of functions that are deprecated and their new names:

http://www.boost.org/doc/libs/1_45_0/libs/filesystem/v2/doc/index.htm

Edit for commment:

It should be something like this:

  boost::filesystem::path p("foo.txt");
  std::cout << p.filename() << std::endl; 

Upvotes: 6

Jean-Baptiste Yun&#232;s
Jean-Baptiste Yun&#232;s

Reputation: 36401

leaf() is deprecated. See: http://www.boost.org/doc/libs/1_46_1/libs/filesystem/v3/doc/reference.html#directory_iterator-members You can try to play without BOOST_FILESYSTEM_NO_DEPRECATED.

Upvotes: 2

Related Questions