udoprog / c10t

A minecraft cartography tool
Other
225 stars 50 forks source link

Build failure due to fileutils.hpp:57:51: error: string_type' has no member named 'string' #165

Closed Charlweed closed 13 years ago

Charlweed commented 13 years ago

I have had this quite a while. I am NOT a C++ coder, but it seems to me that this is a problem with the 64bit version of a template. Here is when I get with a fresh clone: [ 8%] Building CXX object src/mc/CMakeFiles/c10t-mc.dir/blocks.cpp.o [ 12%] Building CXX object src/mc/CMakeFiles/c10t-mc.dir/level.cpp.o In file included from /home/HYMESRUZICKA/chymes/projects/3rdparty/minecraft/c10t_2/src/mc/world.hpp:13:0, from /home/HYMESRUZICKA/chymes/projects/3rdparty/minecraft/c10t_2/src/mc/level.hpp:12, from /home/HYMESRUZICKA/chymes/projects/3rdparty/minecraft/c10t_2/src/mc/level.cpp:3: /home/HYMESRUZICKA/chymes/projects/3rdparty/minecraft/c10t_2/src/fileutils.hpp: In member function 'bool dirlist::hasnext(bool ()(const std::string&), bool (_)(const std::string&))': /home/HYMESRUZICKA/chymes/projects/3rdparty/minecraft/c10t_2/src/fileutils.hpp:57:51: error: 'struct boost::filesystem2::basic_pathstd::basic_string<char, boost::filesystem2::path_traits>::string_type' has no member named 'string' make[3]: * [src/mc/CMakeFiles/c10t-mc.dir/level.cpp.o] Error 1 make[2]: * [src/mc/CMakeFiles/c10t-mc.dir/all] Error 2 make[1]: * [src/CMakeFiles/c10t.dir/rule] Error 2 make: * [c10t] Error 2

Again, I am NOT a c++ coder, but I could see the fail in the template. Anyway, I hacked line 57: if (!file_filter(itr->path().filename().string));

into boost::filesystem2::basic_pathstd::basic_string<char, boost::filesystem2::path_traits>::string_type st; st= itr->path().filename(); std::basic_string cooked; cooked = st.c_str(); if (!file_filter(cooked)) {

My hack is insanely verbose so I can catch whatever typecasting/template problem is occurring.

I don’t know C++ or boost, so I don’t know what the difference in using filename().c_str() instead of filename().string();

samuarl commented 13 years ago

Had the same compile error as well. Ubuntu 11.04 64bit libboost 1.42

My solution was to change line 57 from: if (!file_filter(itr->path().filename().string));

to: if (!file_filter(itr->path().filename()));

Not sure if this is correct but compiled and worked fine for me after

smackysnacks commented 13 years ago

Update your version of boost to the latest. The old filesystem library is deprecated.

Charlweed commented 13 years ago

Yuck. Our Fedora system has boost 1.44, and thats the newest RPM available. I can try to install boost 1.46 in my own account, but could you give me some tips on how to use cmake to build c10t with a local install of boost instead of the system-wide one? I'm googling now :)

Thanks!

Charlweed commented 13 years ago

Ok, that took several hours :( It may be nice to check this into this in the README.md Still not sure what the difference between --prefix and --eprefix really means, but On Linux I did

1) Configure boost with --prefix=~/libs/boost_1_46 --eprefix=~/libs/boost_1_46 2) Build boost with bjam --layout=tagged threading=multi install 3) in c10t/build, run cmake -D CMAKE_PREFIX_PATH=~/libs/boost_1_46 -D CMAKE_INCLUE_PATH=~/libs /boost_1_46 ..