软件包“ raster”的编译失败

时间:2019-03-06 08:56:01

标签: r compilation raster

我在编译“光栅”包时遇到问题。 我试过了 install.packages(“ raster”,Dependencies = TRUE) 没有成功。 有什么建议么? 主要问题是:

g++ -m64 -std=gnu++0x -I/usr/include/R -DNDEBUG  -I"/home/zfgbe/R/x86_64-redhat-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c RasterModule.cpp -o RasterModule.o
In file included from RasterModule.cpp:2:
spat.h:158: error: ISO C++ forbids initialization of member ‘crs’
spat.h:158: error: making ‘crs’ static
spat.h:158: error: invalid in-class initialization of static data member of non-integral type ‘std::string’
spat.h: In member function ‘std::string SpRaster::getCRS()’:
spat.h:200: error: ‘crs’ was not declared in this scope
spat.h: In member function ‘void SpRaster::setCRS(std::string)’:
spat.h:201: error: ‘crs’ was not declared in this scope
make: *** [RasterModule.o] Error 1
ERROR: compilation failed for package ‘raster’

1 个答案:

答案 0 :(得分:0)

问题在于依赖于相当新的C ++实现(C ++ 11)。 栅格的2.5-8版本没有此依赖性。 对我来说,此安装命令有效:

install.packages("https://cran.r-project.org/src/contrib/Archive/raster/raster_2.5-8.tar.gz", repos = NULL, type="source")