无法找到提升

时间:2012-12-04 11:31:01

标签: cmake

我正在尝试使用使用g ++的示例库Mocapy ++。

通过调用cmake .进行安装时出现此错误:

-- 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

现在,如果我尝试调用make,我会收到错误:

[  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

请让我知道怎么回事。 谢谢!

1 个答案:

答案 0 :(得分:2)

CMake过程中没有错误(似乎你可以忽略有关未找到Boost的多条消息)。

但是 Mocapy ++代码中存在一个错误,它试图使用min / max而不是std :: min / std :: max,这就是编译失败的原因为你(并且仍然失败了他们的最新版本)。

如果你想修复它,请修改src/utils/mdarray.h,找到MDArray<T>::clip函数并替换这两行:

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

使用:

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

输入“make”,等待并享受:)