Hello! I am trying to run the example here: http://gallery.rcpp.org/articles/gsl-colnorm-example/ I get the following error: g++ -m64 -I"C:/R/R-30~1.3/include" -DNDEBUG -IC:/GSl-1.16/include -I"E:/Users/peter/Documents/R/win-library/3.0/Rcpp/include" -I"E:/Users/peter/Documents/R/win-library/3.0/RcppGSL/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2 -c test.cpp -o test.o test.cpp:8:1: error: 'Rcpp' does not name a type test.cpp: In function 'SEXPREC* sourceCpp_84035_colNorm(SEXP)': test.cpp:31:50: error: 'colNorm' was not declared in this scope make: *** [test.o] Error 1 Warning message: running command 'make -f "C:/R/R-30~1.3/etc/x64/Makeconf" -f "C:/R/R-30~1.3/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="sourceCpp_54336.dll" WIN=64 TCLBIN=64 OBJECTS="test.o"' had status 2 Error in sourceCpp("test.cpp") : Error 1 occurred building shared library. I have installed GSL using MINGW. I have also set an environmental variable: LIB_GSL=C:/GSL-1.16 as well added the following values to PATH: C:\GSL-1.16 C:\GSL-1.16\bin C:\GSL-1.16\lib C:\GSL-1.16\share Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140402/89d1608e/attachment.html>
[Rcpp-devel] Using GSL in R with Rcpp
4 messages · Petre Caraiani, Dirk Eddelbuettel
On 2 April 2014 at 11:14, Petre Caraiani wrote:
| Hello! | I am trying to run the example here: | http://gallery.rcpp.org/articles/gsl-colnorm-example/ | | I get the following error: | | g++ -m64 -I"C:/R/R-30~1.3/include" -DNDEBUG -IC:/GSl-1.16/include???? -I"E: | /Users/peter/Documents/R/win-library/3.0/Rcpp/include" -I"E:/Users/peter/ | Documents/R/win-library/3.0/RcppGSL/include"? -I"d:/RCompile/CRANpkg/ | extralibs64/local/include"???? -O2 -Wall? -mtune=core2 -c test.cpp -o | test.o 1) Your email does not state how you invoke g++ (or R, which invokes it for you) 2) Your email is not complete as it has no reproducible code 3) Your email refers to a working examples _which still works_ (see below) 4) All you need to know is spelled out in the Rcpp documentation. I am not going to repeat it here. See eg the two chapters on 'compiler etc setup' and RcppGSL in my Rcpp book. Dirk edd at max:~ cd /tmp/ edd at max:/tmp$ cp -vax ~/git/rcpp-gallery/src/*colnorm* . ?/home/edd/git/rcpp-gallery/src/2012-12-22-gsl-colnorm-example.cpp? -> ?./2012-12-22-gsl-colnorm-example.cpp? edd at max:/tmp$ Rscript -e 'library(Rcpp); sourceCpp("2012-12-22-gsl-colnorm-example.cpp")' R> M <- outer(sin(0:9), rep(1, 10), "*") + outer(rep(1, + 10), cos(0:9), "*") R> colNorm(M) [1] 4.31461 3.12050 2.19316 3.26114 2.53416 2.57281 4.20469 3.65202 2.08524 3.07313 R> apply(M, 2, function(x) sqrt(sum(x^2))) [1] 4.31461 3.12050 2.19316 3.26114 2.53416 2.57281 4.20469 3.65202 2.08524 3.07313 edd at max:/tmp$
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
It seems that I am able to run the example in RcppGSL-intro.pdf, section 6, as far as I use the 32 bits R version. So, should I just use cxxfunction, or is there another way to make sourceCpp work for me too? Thanks!
On Wed, Apr 2, 2014 at 11:14 AM, Petre Caraiani <petre.caraiani at gmail.com>wrote:
Hello! I am trying to run the example here: http://gallery.rcpp.org/articles/gsl-colnorm-example/ I get the following error: g++ -m64 -I"C:/R/R-30~1.3/include" -DNDEBUG -IC:/GSl-1.16/include -I"E:/Users/peter/Documents/R/win-library/3.0/Rcpp/include" -I"E:/Users/peter/Documents/R/win-library/3.0/RcppGSL/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2 -c test.cpp -o test.o test.cpp:8:1: error: 'Rcpp' does not name a type test.cpp: In function 'SEXPREC* sourceCpp_84035_colNorm(SEXP)': test.cpp:31:50: error: 'colNorm' was not declared in this scope make: *** [test.o] Error 1 Warning message: running command 'make -f "C:/R/R-30~1.3/etc/x64/Makeconf" -f "C:/R/R-30~1.3/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="sourceCpp_54336.dll" WIN=64 TCLBIN=64 OBJECTS="test.o"' had status 2 Error in sourceCpp("test.cpp") : Error 1 occurred building shared library. I have installed GSL using MINGW. I have also set an environmental variable: LIB_GSL=C:/GSL-1.16 as well added the following values to PATH: C:\GSL-1.16 C:\GSL-1.16\bin C:\GSL-1.16\lib C:\GSL-1.16\share Thanks!
-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140402/d8969ab5/attachment.html>
On 2 April 2014 at 14:26, Petre Caraiani wrote:
| It seems that I am able to run the example in RcppGSL-intro.pdf, section 6, as | far as I use the 32 bits R version. | So, should I just use cxxfunction, or is there another way to make sourceCpp | work for me too? May I suggest you take a look at the available documentation, for example the excellent Rcpp Attributes vignette? Dirk
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com