[Rcpp-devel] Defining template specialisation for wrap on Windows 64bit (Compilation error: 'result_type' does not name a type)

Dirk Eddelbuettel edd at debian.org
Thu Oct 3 14:12:01 CEST 2013


On 3 October 2013 at 12:51, Renaud Gaujoux wrote:
| Some follow up on this issue.
| RcppOctave ships an Octave module that call R own RNG functions, and
| hence need to be compiled against R libraries. The compilation works
| fine on both Linux and Windows (see details below). Note that using
| R_NO_REMAP here really does not make a difference, but I still use it
| just in case. So R and Octave headers are happy together.
| 
| The error really happens at the line where Rccp.h is included, not
| when including RcppCommon.h, nor when declaring the wrap
| specialisation. This is maybe something specific to templates? Are
| these known to be handled differently in Windows and Linux (in
| general, not specifically Rcpp)?

Sorry, I do not know. 

If you only need the RNGs from R, did you consider using R's standalone Math
library?  We can build that fine on Linux, maybe it can be built on Windows?
(Not sure anybody would have it ...)

A complete example including the compile / link is (first comment line wrapped)

    // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; \
           compile-command: "gcc -s -Wall -O3 -I/usr/share/R/include \
                             -o rmath_qbeta rmath_qbeta.c -lRmath -lm" -*-

    #include <stdio.h>
    
    #define MATHLIB_STANDALONE 1
    #include <Rmath.h>
    
    int main(void) {
    
        double x = 0.25, a = 0.8, b = 2.0;
    
        printf("qbeta: %f %f %f %f\n", 
                qbeta(x, a, b, 0, 0), 
                qbeta(log(x), a, b, 0, 1), 
                qbeta(x,     a, b, 1, 0), 
                qbeta(log(x), a, b, 1, 1));
        
        return 0;
    }


Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list