构建时出现mlpack错误

时间:2016-11-09 07:31:50

标签: package ubuntu-14.04 mlpack

安装libmlpack-dev后出现以下错误,将其包含在我的程序中并进行编译。

/usr/include/mlpack/methods/kmeans/kmeans_impl.hpp: In member function ‘void mlpack::kmeans::KMeans<MetricType, InitialPartitionPolicy, EmptyClusterPolicy, LloydStepType, MatType>::Cluster(const MatType&, size_t, arma::mat&, bool)’:
/usr/include/mlpack/methods/kmeans/kmeans_impl.hpp:178:20: error: call of overloaded ‘isnan(double&)’ is ambiguous
 if (isnan(cNorm) || isinf(cNorm))
                ^
/usr/include/mlpack/methods/kmeans/kmeans_impl.hpp:178:20: note: candidates are:
In file included from /usr/include/features.h:374:0,
             from /usr/include/x86_64-linux-gnu/sys/types.h:25

有人可以建议如何解决这个问题。

P.S:我问过这个问题 https://askubuntu.com/questions/847048/mlpack-error-while-building

1 个答案:

答案 0 :(得分:0)

这是旧版Ubuntu上mlpack的问题。如果您将Ubuntu升级到更新版本并更新mlpack包,则应解决该问题。但是如果你不能这样做,你可以直接编辑文件/usr/include/mlpack/methods/kmeans/kmeans_impl.hpp以便行

if (isnan(cNorm) || isinf(cNorm))

更改为

if (std::isnan(cNorm) || std::isinf(cNorm))

这应该可以解决问题。