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

Kevin Ushey kevinushey at gmail.com
Sat May 24 06:04:15 CEST 2014


find . -name "*.cpp" -exec sed -i 's/std::cout/Rcpp::Rcout/g' {} \;

This, or some variant, should get you there.

I suggest version controlling your files before executing, just in case ;)

Kevin
On May 23, 2014 7:22 PM, "Dirk Eddelbuettel" <edd at debian.org> wrote:

>
> 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
>
>
> --
> Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140523/9250a2b0/attachment.html>


More information about the Rcpp-devel mailing list