isciences / exactextractr

R package for fast and accurate raster zonal statistics
https://isciences.gitlab.io/exactextractr/
278 stars 26 forks source link

Github version failing to compile on Win 10 #31

Closed lbusett closed 4 years ago

lbusett commented 4 years ago

Hi,

this is just to let you know that trying to install the github version on Windows 10, I get the following error:

c:/Rtools/mingw_32/bin/g++ -std=gnu++11  -I"C:/PROGRA~1/R/R-3.6.3/include" -DNDEBUG  -I"D:/Documents/R/win-library/3.6/Rcpp/include"     -std=c++14 -I../windows/gdal2-2.2.3/include/geos   -O2 -Wall  -mtune=core2 -c RcppExports.cpp -o RcppExports.o
c:/Rtools/mingw_32/bin/g++ -std=gnu++11  -I"C:/PROGRA~1/R/R-3.6.3/include" -DNDEBUG  -I"D:/Documents/R/win-library/3.6/Rcpp/include"     -std=c++14 -I../windows/gdal2-2.2.3/include/geos   -O2 -Wall  -mtune=core2 -c exact_extract.cpp -o exact_extract.o
In file included from exactextract/src/raster_stats.h:23:0,
                 from exact_extract.cpp:25:
exactextract/src/variance.h: In member function 'constexpr void exactextract::WestVariance::process(double, double) const':
exactextract/src/variance.h:42:15: error: assignment of member 'exactextract::WestVariance::sum_w' in read-only object
         sum_w += w;
               ^
exactextract/src/variance.h:43:14: error: assignment of member 'exactextract::WestVariance::mean' in read-only object
         mean += (w / sum_w) * (x - mean_old);
              ^
exactextract/src/variance.h:44:11: error: assignment of member 'exactextract::WestVariance::t' in read-only object
         t += w * (x - mean_old) * (x - mean);
           ^
exactextract/src/variance.h:39:20: error: invalid return type 'void' of constexpr function 'constexpr void exactextract::WestVariance::process(double, double) const'
     constexpr void process(double x, double w) {
                    ^
make: *** [C:/PROGRA~1/R/R-3.6.3/etc/i386/Makeconf:215: exact_extract.o] Error 1
ERROR: compilation failed for package 'exactextractr'
dbaston commented 4 years ago

Looks like a compiler issue, but one that is easy to work around. Out of curiosity, could you please let me know the output of C:/Rtools/mingw_32/bin/g++ --version ?

Looks like gcc versions >= 5 should be ok.