[Rcpp-devel] Broken (undone) Rmath functions
Lovett, Mitch
mitch.lovett at simon.rochester.edu
Fri Sep 17 16:05:24 CEST 2010
Thanks!
I ran into another compile error in code that compiled with no problem prior to installing the latest versions of Rcpp/RcppArmadillo. It appears related to the changes in the RcppArmadillo package or armadillo code. This is from a machine running MacOsX
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -I/Library/Frameworks/R.framework/Versions/2.11/Resources/library/Rcpp/include -I"/Library/Frameworks/R.framework/Resources/library/RcppArmadillo/include" -I/usr/local/include -fPIC -g -O2 -c cS5like.cpp -o cS5like.o
In file included from /Library/Frameworks/R.framework/Resources/library/RcppArmadillo/include/armadillo:27,
from /Library/Frameworks/R.framework/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:36,
from /Library/Frameworks/R.framework/Resources/library/RcppArmadillo/include/RcppArmadillo.h:25,
from cS5like.cpp:4:
/usr/include/c++/4.2.1/fstream:596: error: 'trunc' is not a member of 'std::ios_base'
/usr/include/c++/4.2.1/fstream:650: error: 'trunc' is not a member of 'std::ios_base'
Also, line 4 of CS5like.cpp is
#include <RcppArmadillo.h>
Thanks,
Mitch
-----Original Message-----
From: Romain Francois [mailto:romain at r-enthusiasts.com]
Sent: Thursday, September 16, 2010 2:22 PM
To: Lovett, Mitch
Cc: rcpp-devel at lists.r-forge.r-project.org
Subject: Re: [Rcpp-devel] Broken (undone) Rmath functions
Le 16/09/10 20:13, Lovett, Mitch a écrit :
> I just joined the mailing list,
welcome !
> so I apologize if this question has
> already been posted.
about 19 hours ago. Feel free to browse the archives either:
- on r-forge : http://lists.r-forge.r-project.org/pipermail/rcpp-devel/
- on gmane : http://news.gmane.org/gmane.comp.lang.r.rcpp
this thread has the information:
http://thread.gmane.org/gmane.comp.lang.r.rcpp/762
> After installing the latest version of Rcpp, my code that called Rmath
> functions no longer works. After a brief look, it appears you are now
> undoing all of the Rmath definitions to allow the new code(?).
yes.
> Is there
> a way to easily undo your undoing of these without breaking the new
> sugar functionality?
You can just prefix your calls with Rf_, so instead of calling dnorm,
you call Rf_dnorm, etc ...
You can use the RCPP_VERSION macro if you want this to work accross Rcpp
versions, something like :
#if defined(RCPP_VERSION) && RCPP_VERSION >= Rcpp_Version(0,8,6)
# define my_dnorm Rf_dnorm
#else
# define my_dnorm dnorm
#endif
Romain
> Any suggestions?
>
> Thanks,
>
> Mitch
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://bit.ly/cCmbgg : Rcpp 0.8.6
|- http://bit.ly/bzoWrs : Rcpp svn revision 2000
`- http://bit.ly/b8VNE2 : Rcpp at LondonR, oct 5th
More information about the Rcpp-devel
mailing list