[Rcpp-devel] Broken (undone) Rmath functions

Lovett, Mitch mitch.lovett at simon.rochester.edu
Fri Sep 17 16:42:35 CEST 2010


Thanks for the help.

I am running 10.6.4 on a (few weeks old) 12 core Mac Pro.

I tried commenting out the #undef for trunc and had to also comment out ftrunc, which then allowed me to compile and appears to be running fine.

Mitch

-----Original Message-----
From: Dirk Eddelbuettel [mailto:edd at debian.org] 
Sent: Friday, September 17, 2010 10:20 AM
To: Lovett, Mitch
Cc: Romain Francois; rcpp-devel at lists.r-forge.r-project.org; Conrad Sanderson
Subject: Re: [Rcpp-devel] Broken (undone) Rmath functions


Mitch,

On 17 September 2010 at 10:05, Lovett, Mitch wrote:
| 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 

What flavour?  Romain himself is on the newest and didn't see that.


 
| 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'

Darn 4.2.1 again.  Conrad had issues with that before.  We really like 4.3,
4.4 and 4.5 better.

Could you, as a stop-gap measure, comment this out on your end

      #undef trunc

in the include file sugar/undoRmath.h of Rcpp?

**Sure. No problem.

Dirk
 
(Conrad: R has a macros trunc which we are undoing. This is other Armadillo
0.9.70; but neither you nor us use trunc() it seems.)


 
| 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
| 
| 
| _______________________________________________
| 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

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


More information about the Rcpp-devel mailing list