[Rcpp-devel] Problem with NumericVector or NumericMatrix

Philippe Huber ph_geneve at hotmail.com
Tue Mar 1 10:29:39 CET 2016


Hi,
I am starting to use Rcpp and got into some issues with basic examples.
I am trying to run this:
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]NumericVector timesTwo(NumericVector x) {  return x * 2;}
It works fine when I use it like:> evalCpp(timesTwo(2))[1] 4
But as soon as I use a vector, I get some weird error message:
> v=as.vector(c(2,2))> evalCpp(timesTwo(v))g++ -m64 -I"C:/PROGRA~1/R/R-32~1.3/include" -DNDEBUG     -I"C:/Users/Hubert/Documents/R/win-library/3.2/Rcpp/include" -I"C:/Users/Hubert/AppData/Local/Temp/RtmpaujML3"  -I"d:/RCompile/r-compiling/local/local323/include"     -O2 -Wall  -mtune=core2 -c file33c329d4fd2.cpp -o file33c329d4fd2.ofile33c329d4fd2.cpp: In function 'SEXPREC* get_value()':file33c329d4fd2.cpp:7:6: error: redefinition of 'SEXPREC* get_value()'file33c329d4fd2.cpp:6:6: error: 'SEXPREC* get_value()' previously defined heremake: *** [file33c329d4fd2.o] Error 1Warning message:l'exécution de la commande 'make -f "C:/PROGRA~1/R/R-32~1.3/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-32~1.3/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="sourceCpp_10.dll" WIN=64 TCLBIN=64 OBJECTS="file33c329d4fd2.o"' renvoie un statut 2 Error in sourceCpp(code = code, env = env, rebuild = rebuild, showOutput = showOutput,  :   Error 1 occurred building shared library.
I tried to find a solution but got nothing.
Can someone please help me?
Thanks
Philippe

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20160301/6b58c97a/attachment.html>


More information about the Rcpp-devel mailing list