<div dir="ltr"><span style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Hi,</span><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial">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: </div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><pre class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCGSB" id="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-rstudio_console_output" style="white-space:pre-wrap;font-family:"Ubuntu Mono";outline:none;border:none;word-break:break-all;margin:0px;line-height:16px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;text-align:-webkit-left;background-color:rgb(255,255,255);font-size:10.4pt"><i><font color="#000000"><span class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCASB gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-ace_constant">Error in .Call(<pointer: (nil)>, x) :
NULL value passed as symbol address
</span><span class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCGSB" style="outline:none;border:none;word-break:break-all;margin:0px;white-space:pre-wrap">Called from: MakeSquare(x = val)</span></font></i></pre><pre class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCGSB" id="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-rstudio_console_output" style="white-space:pre-wrap;font-family:"Ubuntu Mono";outline:none;border:none;word-break:break-all;margin:0px;line-height:16px;color:rgb(0,0,0);font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;text-align:-webkit-left;background-color:rgb(255,255,255);font-size:10.4pt"><span><span class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCGSB" style="outline:none;border:none;word-break:break-all;margin:0px;white-space:pre-wrap"><br></span></span></pre><pre class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCGSB" id="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-rstudio_console_output" style="white-space:pre-wrap;font-family:"Ubuntu Mono";outline:none;border:none;word-break:break-all;margin:0px;line-height:16px;color:rgb(0,0,0);font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;text-align:-webkit-left;background-color:rgb(255,255,255);font-size:10.4pt"><span><span class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCGSB" style="outline:none;border:none;word-break:break-all;margin:0px;white-space:pre-wrap">This is just a simple function I have created for testing:</span></span></pre><pre class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCGSB" id="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-rstudio_console_output" style="white-space:pre-wrap;font-family:"Ubuntu Mono";outline:none;border:none;word-break:break-all;margin:0px;line-height:16px;color:rgb(0,0,0);font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;text-align:-webkit-left;background-color:rgb(255,255,255);font-size:10.4pt"><span><span class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCGSB" style="outline:none;border:none;word-break:break-all;margin:0px;white-space:pre-wrap"><br></span></span></pre><pre class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCGSB" id="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-rstudio_console_output" style="white-space:pre-wrap;outline:none;border:none;word-break:break-all;margin:0px;line-height:16px;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:-webkit-left;background-color:rgb(255,255,255)"><span class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCGSB" style="outline:none;border:none;word-break:break-all;margin:0px;font-size:13.8667px;white-space:pre-wrap"><font color="#000000" face="Ubuntu Mono">cppFunction('double MakeSquare(double x){
double result = 0;
result = x*x;
return result; </font></span></pre><pre class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCGSB" id="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-rstudio_console_output" style="white-space:pre-wrap;outline:none;border:none;word-break:break-all;margin:0px;line-height:16px;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:-webkit-left;background-color:rgb(255,255,255)"><span class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCGSB" style="outline:none;border:none;word-break:break-all;margin:0px;font-size:13.8667px;white-space:pre-wrap"><font color="#000000" face="Ubuntu Mono">}')</font></span><span class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCGSB" style="color:rgb(0,0,0);font-family:"Ubuntu Mono";font-size:10.4pt;font-weight:normal;white-space:pre-wrap;outline:none;border:none;word-break:break-all;margin:0px">
</span></pre><div><span><span class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCGSB" style="outline:none;border:none;word-break:break-all;margin:0px;white-space:pre-wrap"><br></span></span></div><div><span><span class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCGSB" style="outline:none;border:none;word-break:break-all;margin:0px;white-space:pre-wrap">The Rcpp function I have created above is called by another function:</span></span></div><div><span><span class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCGSB" style="outline:none;border:none;word-break:break-all;margin:0px;white-space:pre-wrap"><br></span></span></div><div><span><span class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCGSB" style="outline:none;border:none;word-break:break-all;margin:0px;white-space:pre-wrap"><div>CalcSquare <- function(val1,val2){</div><div> valResult <- (val1 + val2)/2</div><div> valSquare <- MakeSquare(x = valResult)</div><div> return(valSquare)</div><div>}</div></span></span></div><div><span><span class="gmail-m_-1302618682804229171gmail-m_-6142029306545927561gmail-GNKRCKGCGSB" style="outline:none;border:none;word-break:break-all;margin:0px;white-space:pre-wrap"><br></span></span></div><br></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial">I have imported all the necessary packages, including Rcpp. I have looked at different discussion forums by I did not find any solution.</div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial">I sincerely hope you could help me.</div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial">Best regards,</div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial">André</div><br></div>