Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix three bugs in quick ref vignette #933

merged 4 commits into from Dec 26, 2018


None yet
2 participants
Copy link

dongzhuoer commented Dec 26, 2018

close #932

dongzhuoer added some commits Dec 22, 2018

Named[] should be Named() in quick intro vignette
> Rcpp::evalCpp('NumericVector::create(Named["foo"] = 1.0,_["bar"] = 2.0 )')
file419870ee27e6.cpp: In function ‘SEXPREC* get_value()’:
file419870ee27e6.cpp:6:65: error: invalid types ‘<unresolved overloaded function type>[const char [4]]’ for array subscript
 SEXP get_value(){ return wrap( NumericVector::create(Named["foo"] = 1.0,_["bar"] = 2.0 ) ) ; }
make: *** [file419870ee27e6.o] Error 1
g++  -I"/usr/share/R/include" -DNDEBUG   -I"/home/zhuoer/.local/lib/R/Rcpp/include" -I"/tmp/Rtmp7XEiDX/sourceCpp-x86_64-pc-linux-gnu-1.0.0"    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-oUvOgu/r-base-3.5.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c file419870ee27e6.cpp -o file419870ee27e6.o
/usr/lib/R/etc/Makeconf:168: recipe for target 'file419870ee27e6.o' failed
Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir,  : 
  Error 1 occurred building shared library.
> Rcpp::evalCpp('NumericVector::create(Named("foo") = 1.0,_["bar"] = 2.0 )')
foo bar 
  1   2
add definition for `glob` in quick intro vignette
I also adjust the relative position of " Special environments" and "Obtain an R environment", since `Environment::global_env()` is introduced in the former
`` need a bool argument in quick intro vignette
file59666c8ac214.cpp: In function ‘SEXPREC* get_value()’:
file59666c8ac214.cpp:6:61: error: no matching function for call to ‘Rcpp::Environment_Impl<Rcpp::PreserveStorage>::ls()’
 SEXP get_value(){ return wrap( Environment::global_env().ls() ) ; }
In file included from /home/zhuoer/.local/lib/R/Rcpp/include/Rcpp.h:38:0,
                 from file59666c8ac214.cpp:1:
/home/zhuoer/.local/lib/R/Rcpp/include/Rcpp/Environment.h:85:14: note: candidate: SEXPREC* Rcpp::Environment_Impl<StoragePolicy>::ls(bool) const [with StoragePolicy = Rcpp::PreserveStorage; SEXP = SEXPREC*]
         SEXP ls(bool all) const {
/home/zhuoer/.local/lib/R/Rcpp/include/Rcpp/Environment.h:85:14: note:   candidate expects 1 argument, 0 provided
make: *** [file59666c8ac214.o] Error 1
g++  -I"/usr/share/R/include" -DNDEBUG   -I"/home/zhuoer/.local/lib/R/Rcpp/include" -I"/tmp/RtmpXtPnoL/sourceCpp-x86_64-pc-linux-gnu-1.0.0"    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-oUvOgu/r-base-3.5.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c file59666c8ac214.cpp -o file59666c8ac214.o
/usr/lib/R/etc/Makeconf:168: recipe for target 'file59666c8ac214.o' failed
Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir,  :
  Error 1 occurred building shared library.

[1] ".Random.seed"

eddelbuettel provides another example

cppFunction("CharacterVector foo() { Environment glob=Environment::global_env(); return; }" )
[1] ".Random.seed" "foo"

This comment has been minimized.

Copy link

eddelbuettel commented Dec 26, 2018

Looks good to me, apart from a small whitespace issue in the ChangeLog I will take care of once merged!

Thanks for putting this together.

@eddelbuettel eddelbuettel merged commit e44c6fa into RcppCore:master Dec 26, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

eddelbuettel added a commit that referenced this pull request Dec 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.