error: ISO C++ forbids initialization of member ‘valid’

> install.packages("farver")
Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
trying URL 'https://mirrors.bfsu.edu.cn/CRAN/src/contrib/farver_2.0.3.tar.gz'
Content type 'application/octet-stream' length 1279579 bytes (1.2 MB)
==================================================
downloaded 1.2 MB

* installing *source* package ‘farver’ ...
** package ‘farver’ successfully unpacked and MD5 sums checked
** libs
g++ -m64 -std=gnu++0x -I"/usr/include/R" -DNDEBUG   -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 ColorSpace.cpp -o ColorSpace.o
In file included from ColorSpace.cpp:1:
ColorSpace.h:19: error: ISO C++ forbids initialization of member ‘valid’
ColorSpace.h:19: error: making ‘valid’ static
ColorSpace.h:19: error: ISO C++ forbids in-class initialization of non-const static member ‘valid’
make: *** [ColorSpace.o] Error 1
ERROR: compilation failed for package ‘farver’
* removing ‘/usr/lib64/R/library/farver’

The downloaded source packages are in
    ‘/tmp/RtmpW8Ai7S/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("farver") :
  installation of package ‘farver’ had non-zero exit status

REF

https://cran.r-project.org/web/packages/farver/index.html

farver: High Performance Colour Space Manipulation

The encoding of colour can be handled in many different ways, using different colour spaces. As different colour spaces have different uses, efficient conversion between these representations are important. The 'farver' package provides a set of functions that gives access to very fast colour space conversion and comparisons implemented in C++, and offers speed improvements over the 'convertColor' function in the 'grDevices' package.

Version: 2.0.3
Suggests: testthat (≥ 2.1.0), covr
Published: 2020-01-16
Author: Thomas Lin Pedersen ORCID iD [cre, aut], Berendea Nicolae [aut] (Author of the ColorSpace C++ library), Romain François ORCID iD [aut]
Maintainer: Thomas Lin Pedersen <thomasp85 at gmail.com>
BugReports: https://github.com/thomasp85/farver/issues
License: MIT + file LICENSE
URL: https://farver.data-imaginist.com, https://github.com/thomasp85/farver
NeedsCompilation: yes
SystemRequirements: C++11
Materials: README NEWS
CRAN checks: farver results

Downloads:

Reference manual: farver.pdf
Package source: farver_2.0.3.tar.gz
Windows binaries: r-devel: farver_2.0.3.zip, r-release: farver_2.0.3.zip, r-oldrel: farver_2.0.3.zip
macOS binaries: r-release: farver_2.0.3.tgz, r-oldrel: farver_2.0.3.tgz
Old sources: farver archive

Reverse dependencies:

Reverse imports: brickr, distributional, imgpalr, plothelper, prismatic, scales, tweenr
Reverse suggests: aqp

Linking:

Please use the canonical form https://CRAN.R-project.org/package=farver to link to this page.

> BiocManager::install("isoband")
Bioconductor version 3.8 (BiocManager 1.30.10), R 3.5.2 (2018-12-20)
Installing package(s) 'isoband'
trying URL 'https://cran.rstudio.com/src/contrib/isoband_0.2.2.tar.gz'
Content type 'application/x-gzip' length 2295931 bytes (2.2 MB)
==================================================
downloaded 2.2 MB

* installing *source* package ‘isoband’ ...
** package ‘isoband’ successfully unpacked and MD5 sums checked
** libs
g++ -m64 -std=gnu++0x -I"/usr/include/R" -DNDEBUG  -I"/usr/lib64/R/library/testthat/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 clip-lines.cpp -o clip-lines.o
In file included from clip-lines.cpp:12:
utils.h:28: error: expected unqualified-id before ‘[’ token
make: *** [clip-lines.o] Error 1
ERROR: compilation failed for package ‘isoband’
* removing ‘/usr/lib64/R/library/isoband’

The downloaded source packages are in
    ‘/tmp/RtmpkJ1ZJ7/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages(...) :
  installation of package ‘isoband’ had non-zero exit status

REF

https://stackoverflow.com/questions/55019040/compilation-failed-for-package-raster

https://stackoverflow.com/questions/48676498/when-i-try-to-install-rselenium-package-in-r-i-have-got-this-error-error-iso

https://github.com/igraph/rigraph/issues/338

https://github.com/thomasp85/farver/issues/17

https://github.com/wilkelab/isoband/issues/13

原文地址:https://www.cnblogs.com/emanlee/p/13912776.html