2

I'm trying to use a sample library Mocapy++ that uses g++.

While installing by invoking cmake . I get this error:

-- Boost version: 1.52.0
-- Boost version: 1.52.0
-- Found the following Boost libraries:
--   serialization
--   program_options
--   thread
running /usr/bin/cmake -E create_symlink "/home/vishalnus/Downloads/Mocapy++-1.07 /examples/data" "/home/vishalnus/Downloads/Mocapy++-1.07/examples/data"  2>&1
-- Could NOT find Boost
-- Could NOT find Boost
-- Could NOT find Boost
-- Could NOT find Boost
-- Boost version: 1.52.0
-- Found the following Boost libraries:
--   serialization
-- Could NOT find Boost
-- Boost version: 1.52.0
-- Found the following Boost libraries:
--   serialization
-- Could NOT find Boost
-- Configuring done
-- Generating done
-- Build files have been written to: <home>/Downloads/Mocapy++-1.07

Now, if I try to invoke make I get the error:

[  1%] Building CXX object src/CMakeFiles/Mocapy.dir/discrete/discretedensities.cpp.o
In file included from /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/../framework/../discrete/../framework/../utils/utils.h:47:0,
from /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/../framework/../discrete/../framework/essbase.h:29,
from /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/../framework/../discrete/discreteess.h:24,
from /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/../framework/../discrete/discretepriors.h:31,
from /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/../framework/densitiesbase.h:30,
from /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/discretedensities.h:29,
from /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/discretedensities.cpp:22:
/home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/../framework/../discrete/../framework/../utils/mdarray.h: In instantiation of ‘void mocapy::MDArray<T>::clip(double, double) [with T = double]’:
/home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/discretedensities.cpp:61:32:   required from here
/home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/../framework/../discrete/../framework/../utils/mdarray.h:1252:4: error: ‘max’ was not declared in this scope, andno declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
  In file included from /usr/include/c++/4.7/bits/char_traits.h:41:0,
             from /usr/include/c++/4.7/ios:41,
             from /usr/include/c++/4.7/ostream:40,
             from /usr/local/include/boost/archive/text_oarchive.hpp:19,
             from /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/discretedensities.h:25,
             from /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/discretedensities.cpp:22:
 /usr/include/c++/4.7/bits/stl_algobase.h:254:5: note: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ declared here, later in the translation unit
 In file included from /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/../framework/../discrete/../framework/../utils/utils.h:47:0,
 from /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/../framework/../discrete/../framework/essbase.h:29,
 from /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/../framework/../discrete/discreteess.h:24,
 from /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/../framework/../discrete/discretepriors.h:31,
 from /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/../framework/densitiesbase.h:30,
 from /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/discretedensities.h:29,
 from /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/discretedensities.cpp:22:
 /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/../framework/../discrete/../framework/../utils/mdarray.h:1253:4: error: ‘min’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
   In file included from /usr/include/c++/4.7/bits/char_traits.h:41:0,
             from /usr/include/c++/4.7/ios:41,
             from /usr/include/c++/4.7/ostream:40,
             from /usr/local/include/boost/archive/text_oarchive.hpp:19,
             from /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/discretedensities.h:25,
             from /home/vishalnus/Downloads/Mocapy++-1.07/src/discrete/discretedensities.cpp:22:
  /usr/include/c++/4.7/bits/stl_algobase.h:233:5: note: ‘template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’ declared here, later in the translation unit
  make[2]: *** [src/CMakeFiles/Mocapy.dir/discrete/discretedensities.cpp.o] Error 1
  make[1]: *** [src/CMakeFiles/Mocapy.dir/all] Error 2
  make: *** [all] Error 2

Please let me know how t go about. Thanks!

1 Answer 1

2

There's no errors in the CMake process (it seems you can just ignore the multiple messages about not finding Boost).

But there's a bug in the Mocapy++ code, it's trying to use min/max instead of std::min/std::max, that's why the compilation failed for you (and still fails with their latest release).

If you want to fix it, edit src/utils/mdarray.h, find the MDArray<T>::clip function and replace those two lines:

values[i] = max(minimum, values[i]);
values[i] = min(maximum, values[i]);

with:

values[i] = std::max(minimum, values[i]);
values[i] = std::min(maximum, values[i]);

Type "make", wait and enjoy :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.