Rcpp 中未使用的变量错误 [英] Wunused-variable errors in Rcpp

查看:37
本文介绍了Rcpp 中未使用的变量错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编译时,我收到了很多我很想解决的警告.大约有 30 个,但它们或多或少都像前三个:

On compilation I am getting lots of warnings that I would love to resolve. There are 30 or so but they all more or less look like these first three:

==> Rcpp::compileAttributes()
* Updated src/RcppExports.cpp

==> roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))

Creating a generic function for ‘as.list’ from package ‘base’ in package ‘roxygen_devtest’
Documentation completed

==> R CMD INSTALL --no-multiarch --with-keep.source myPackage

* installing to library ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library’
* installing *source* package ‘myPackage’ ...
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.3/Resources/library/BH/include"   -fPIC  -Wall -mtune=core2 -g -O2 -c RcppExports.cpp -o RcppExports.o
** libs
RcppExports.cpp:14:1: warning: unused variable 'rcpp_output_type' [-Wunused-variable]
BEGIN_RCPP
^

/Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rcpp/include/Rcpp/macros/macros.h:31:9: note: expanded from macro 'BEGIN_RCPP'
int rcpp_output_type = 0 ;                                                                   \
    ^
RcppExports.cpp:14:1: warning: unused variable 'rcpp_output_condition' [-Wunused-variable]
/Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rcpp/include/Rcpp/macros/macros.h:32:10: note: expanded from macro 'BEGIN_RCPP'
SEXP rcpp_output_condition = R_NilValue ;                                                    \
     ^
RcppExports.cpp:49:1: warning: unused variable 'rcpp_output_type' [-Wunused-variable]
BEGIN_RCPP
^
/Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rcpp/include/Rcpp/macros/macros.h:31:9: note: expanded from macro 'BEGIN_RCPP'
int rcpp_output_type = 0 ;                                                                   \
    ^
RcppExports.cpp:49:1: warning: unused variable 'rcpp_output_condition' [-Wunused-variable]
/Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rcpp/include/Rcpp/macros/macros.h:32:10: note: expanded from macro 'BEGIN_RCPP'
SEXP rcpp_output_condition = R_NilValue ;                                                    \
     ^

<小时>

如果有人能指出我正确的方向,我将不胜感激.如果需要更多输出,我可以提供,我只是想让消息尽可能简短.


If anyone can point me in the right direction I would appreciate it. If more of the output is needed I can provide it, I just wanted to keep the message as short as possible.

推荐答案

我只是将这个添加到 ~/.R/Makevars 文件中的 CXXFLAGS 中:

I just add this to CXXFLAGS in the file ~/.R/Makevars:

CXXFLAGS +=           -O3 -Wall -pipe -Wno-unused 

这篇关于Rcpp 中未使用的变量错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆