rcppmlpack / RcppMLPACK1

60 stars 14 forks source link

mlpack::kmeans won't compile and build on windows #22

Open tds151 opened 7 years ago

tds151 commented 7 years ago

The following basic KMeans implementation using RcppMLPACK (v. 1 on CRAN) fails to compile and build with RcppAttributes under Windows R 3.4.1 using the gcc 4.9.3 RTools chain .

// [[Rcpp::depends(RcppMLPACK)]] // [[Rcpp::plugins(cpp11)]]

include "RcppMLPACK.h"

using namespace Rcpp; using namespace arma; using namespace mlpack::kmeans;

// [[Rcpp::export]] List cppKmeans(const mat& data, const int& clusters) { // data is R x N matrix where the columns index multivariate observations Col assignments; KMeans<> k; // Initialize with the default arguments. k.Cluster(data, clusters, assignments); return List::create(Named(”clusters”) = clusters, Named(”s”) = assignments

); } / end function cppKmeans() /

with lots of error messages like this (relating to mp_thread_limit not declared):

C:/R/R-devel/library/RcppArmadillo/include/armadillo_bits/fn_accu.hpp:180:7: error: invalid controlling predicate for(uword thread_id=0; thread_id < n_threads_use; ++thread_id) ^ C:/R/R-devel/library/RcppArmadillo/include/armadillo_bits/fn_accu.hpp:205:7: error: invalid controlling predicate for(uword thread_id=0; thread_id < n_threads_use; ++thread_id) ^

eddelbuettel commented 7 years ago

That is older (and stale) code. Maybe try an older (corresponding) RcppArmadillo release with it.