Reputation: 43
I created an R package using RcppArmadillo from my Mac, and then built and installed it by doing the following:
Rcpp::compileAttributes()
devtools::build()
devtools::install()
However, I received several same warnings as below:
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppArmadillo/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fopenmp -fPIC -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppArmadillo/include/RcppArmadillo.h:34:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp.h:57:
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp/DataFrame.h:136:18: warning: unused variable 'data' [-Wunused-variable]
SEXP data = Parent::get__();
^
1 warning generated.
The package works fine although there are warnings during installation. Does anyone know how I can get rid of these warnings?
(I tried the answer here: Wunused-variable errors in Rcpp, but I still got the warnings.)
Upvotes: 4
Views: 1052
Reputation: 368181
My previous (generic) StackOverflow answer (which you already referenced in your question) is still valid: Add the flag to CXXFLAGS
(and maybe also CXX11FLAGS
).
Alternatively, you can install an updated Rcpp version from the Rcpp Drat repo via
install.packages("Rcpp", repos="https://rcppcore.github.io/drat")
to get an Rcpp version with this fixes, and some other new versions. These fix will eventually make it into the CRAN version.
Edit: Here is a link to relevant announcement to the Rcpp mailing list.
Upvotes: 3