[Rcpp-devel] Building of a package with roxygen2 using Rcpp in R version 5.1

André Luiz Molan andre.molan at unesp.br
Wed Sep 5 20:37:43 CEST 2018


Hi,

I'm trying to create an R package using Rcpp. I am using the "Build" option
from RStudio and roxygen2 package. My package is build with no error
messages and normally loaded. However, when I call a function from the new
package, I have the following message:

*Error in .Call(<pointer: (nil)>, x) :
  NULL value passed as symbol address
Called from: MakeSquare(x = val)*


This is just a simple function I have created for testing:


cppFunction('double MakeSquare(double x){
        double result = 0;
        result = x*x;
        return result;

}')


The Rcpp function I have created above is called by another function:

CalcSquare <- function(val1,val2){
    valResult <- (val1 + val2)/2
    valSquare <- MakeSquare(x = valResult)
    return(valSquare)
}


I have imported all the necessary packages, including Rcpp. I have looked
at different discussion forums by I did not find any solution.

I sincerely hope you could help me.

Best regards,

André
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20180905/073febab/attachment.html>


More information about the Rcpp-devel mailing list