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 <[email protected]> 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
> [email protected]
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to