1

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

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

PS:我在 https://askubuntu.com/questions/847048/mlpack-error-while-building中问过这个

4

1 回答 1

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

这应该可以解决问题。

于 2016-11-14T18:07:32.773 回答