[Rcpp-devel] Error when calling `qchisq()`.

Simon Zehnder szehnder at uni-bonn.de
Fri Jul 5 18:47:08 CEST 2013


Hi Xiao,

I assume, that you have to use the function with its namespace R::qchisq(). The 'using namespace Rcpp;' command does not include the namespace R in which the function qchisq is defined. 

Best

Simon


On Jul 5, 2013, at 6:22 PM, Xiao He <praguewatermelon at gmail.com> wrote:

> Hi,
> 
> I tried to call qchisq() (see mock code below). But while compiling it, I got an error message saying ` error: no matching function for call to ‘qchisq(double, double, int, int)’`. I checked this file: http://dirk.eddelbuettel.com/code/rcpp/html/Rmath_8h_source.html, and saw this: " double qchisq(double p, double df, int lt, int lg)" . The four arguments in the mock code also follow the double, double, int, int form. So I wonder what the problem is with my way of specifying the code. Thanks.
> 
> 
> #include <R.h>
> #include <stdio.h>
> #include <RcppArmadillo.h>
> // [[Rcpp::depends(RcppArmadillo)]]
> 
> using namespace Rcpp;
> using namespace arma;
> 
> RcppExport SEXP foo(SEXP X){
> 	NumericVector x(X);
> 	double output = qchisq(0.5, (double)x(0), 1, 0);
> 	return(wrap(output));
> }
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130705/bbdb92b5/attachment.html>


More information about the Rcpp-devel mailing list