[Rcpp-devel] Problems with Rcout

Dirk Eddelbuettel edd at debian.org
Tue Feb 5 22:33:11 CET 2019


On 5 February 2019 at 15:26, Barth Riley wrote:
| I think std:endl should be std::endl

Indeed.

I actually made the same typo a few days ago but as I recall the compiler was
also pretty clear that I was wrong there and gave me a hint.

Quick check seems to confirm that:

R> library(Rcpp)
R> cppFunction("bool foo() { Rcpp::Rcout << \"abc\" << std:endl; }")
file755d734bf516.cpp: In function ‘bool foo()’:
file755d734bf516.cpp:6:41: error: found ‘:’ in nested-name-specifier, expected ‘::’
 bool foo() { Rcpp::Rcout << "abc" << std:endl; }
                                         ^
                                         ::
file755d734bf516.cpp:6:48: warning: no return statement in function returning non-void [-Wreturn-type]
 bool foo() { Rcpp::Rcout << "abc" << std:endl; }
                                                ^
make: *** [/usr/lib/R/etc/Makeconf:171: file755d734bf516.o] Error 1
ccache g++ -I"/usr/share/R/include" -DNDEBUG   -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/tmp/RtmpZ8jFZ4/sourceCpp-x86_64-pc-linux-gnu-1.0.0.1"    -fpic  -g -O3 -Wall -pipe -DBOOST_NO_AUTO_PTR -Wno-sign-compare -Wno-parentheses -Wno-maybe-uninitialized  -march=native -c file755d734bf516.cpp -o file755d734bf516.o
Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir,  : 
  Error 1 occurred building shared library.
R> 


(As an aside, I really dig how the error messages got better. This is g++
8.2.0 on Ubuntu 18.10.)

Dirk

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


More information about the Rcpp-devel mailing list