[Rcpp-devel] Converting std::cout to Rcpp::Rcout automatically

Dirk Eddelbuettel edd at debian.org
Sat May 24 04:22:01 CEST 2014

On 23 May 2014 at 21:22, Qiang Kou wrote:
| I am using Rcpp to integrate an available C++ library with R.
| Since the std::cout and std::cerr are not permitted when uploading to CRAN, I
| have to modify files manually. It will be somewhat laborious if the library 
| Does anyone have any idea how can I do that automatically?

I am afraid there is none.  Rcpp::Rcout is a trick to fold 'our' output into
R's; there is no trick to fold the system output.

One trick may be to ... use the library as an external object that you link
to.  That way CRAN won't check the library code as part of the submission
(but if it is a custom/complicated library you may have the problem of
getting onto CRAN build servers -- I am currently for libhiredis to make it
onto the win-builder / CRAN windows build side of things.

But barring that you may need to change all std::cout instances (and yes,
I've done that once too).


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

More information about the Rcpp-devel mailing list