[Rcpp-devel] RcppArmadillo and Rdefines

Charles Determan Jr deter088 at umn.edu
Tue Feb 24 21:41:37 CET 2015


Thank you for that clarification, I always seem to forget that Rcpp
packages have many libraries loaded by default.  I have trimmed the headers
down to the following to just

#include <RcppArmadillo>

However, some further background, I am working on extending the bigalgebra
package (hence the interest in RcppArmadillo) so their are some additional
headers that are now included in this problem.  The total headers now looks
like this:

#include "bigmemory/BigMatrix.h"

#include <RcppArmadillo.h>

#ifdef REFBLAS
#include "refblas64longlong.h"
#define INT long long
#else
#include <R_ext/BLAS.h>
#include <R_ext/Lapack.h>
#define INT int
#endif

Again, if I simply change RcppArmadillo to Rcpp it compiles without a
problem but with RcppArmadillo more of the 'length passed 4 arguments' and
also 'const string has no member name 'Rf_length' errors.

Thanks again,
Charles


On Tue, Feb 24, 2015 at 1:06 PM, Dirk Eddelbuettel <edd at debian.org> wrote:

>
> On 24 February 2015 at 12:30, Charles Determan Jr wrote:
> | Greetings,
> |
> | I have run in to an error when compiling an R package that has the
> following
> | headers in the only cpp file at the moment:
> |
> | #include <string>
> | #include <iostream>
> | #include <cmath>
> |
> | #define R_NO_REMAP
> |
> | #include <R.h>
> | #include <Rinternals.h>
> | #include <Rdefines.h>
> |
> | Now, I am also trying to use RcppArmadillo with:
> |
> | #include <RcppArmadillo.h>
> | // [[Rcpp::depends(RcppArmadillo)]
> |
> | However, when I try and build the package, it errors out with a bunch of
> errors
> | such as:
> |
> | /usr/include/c++/4.8/bits/fstream.tcc:824:60: error: macro "length"
> passed 4
> | arguments, but takes just 1
> |
> | which is repeated multiple times on different lines.  I haven't included
> the
> | entire output as it is rather lengthly but could provide if it would help
> | further.  I tried searching for help but the closest I found was this
> previous
> | post (
> http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2013-February/
> | 005325.html) but the R_NO_REMAP hasn't helped here.  I suspect something
> must
> | be conflicted between the R headers and RcppArmadillo because it works
> just
> | fine if I only use Rcpp.h (but I want to use RcppArmadillo).  Any
> thoughts?
>
> I definitely have fought this too way back when.  I think we generally do
> the
> right thing now as it no longer "spills" out of Rcpp proper.
>
> You do have a bit of a mess here with headers:
>
>   a) you may not need all of string, iostream, cmath; I think we include
> some
>     (all?) of these.  You may need just iostream
>
>   b) you do not need R.h; you probably do not need the others
>
>   c) just RcppArmadillo is good and often self-sufficient
>
> so I would quickly restart from the inside out with just RcppArmadillo.h
> and
> then add code paragraph by paragraph and judiciously only add the headers
> you
> need.
>
> Dirk
>
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
>



-- 
Dr. Charles Determan, PhD
Integrated Biosciences
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20150224/02fdd674/attachment-0001.html>


More information about the Rcpp-devel mailing list