Problema resolvido.

code <- '
using namespace std;
std::vector<double> volumes() {
std::vector<double> v(5);
v[0] = GSL_CONST_MKSA_US_GALLON;       // 1 US gallon
v[1] = GSL_CONST_MKSA_CANADIAN_GALLON; // 1 Canadian gallon
v[2] = GSL_CONST_MKSA_UK_GALLON;       // 1 UK gallon
v[3] = GSL_CONST_MKSA_QUART;           // 1 quart
v[4] = GSL_CONST_MKSA_PINT;            // 1 pint
return v;
}'

gslVolumes <- cppFunction(code, depends="RcppGSL",includes="#include 
<gsl/gsl_const_mksa.h>")
gslVolumes()



Em 19/10/2013, às 17:46, Carlos Trucios Maza <[email protected]> escreveu:

> Pessoal boa tarde,
> 
> Estou tentando reproducir um código do livro sobre Rcpp e não estou 
> conseguindo. Alguém tem alguma ideia de porque não funciona?
> (Trabalho com OS X 10.8.4).
> 
> 
> code <- '
> #include <gsL/gsl_const_mksa.h>           // decl of constants
> std::vector<double> volumes() {
> std::vector<double> v(5);
> v[0] = GSL_CONST_MKSA_US_GALLON;       // 1 US gallon
> v[1] = GSL_CONST_MKSA_CANADIAN_GALLON; // 1 Canadian gallon
> v[2] = GSL_CONST_MKSA_UK_GALLON;       // 1 UK gallon
> v[3] = GSL_CONST_MKSA_QUART;           // 1 quart
> v[4] = GSL_CONST_MKSA_PINT;            // 1 pint
> return v;
> }'
> 
> gslVolumes <- cppFunction(code, depends="RcppGSL")
> 
> mas aparece o seguinte erro
> 
> file16e2b6cb966.cpp: In function ‘SEXPREC* sourceCpp_52966_volumes()’:
> file16e2b6cb966.cpp:30: error: ‘__result’ was not declared in this scope
> make: *** [file16e2b6cb966.o] Error 1
> llvm-g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include 
> -DNDEBUG -I/usr/local/include 
> -I/Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include 
> -I/usr/local/include  
> -I"/Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include"
>  
> -I"/Library/Frameworks/R.framework/Versions/3.0/Resources/library/RcppGSL/include"
>     -fPIC  -mtune=core2 -g -O2  -c file16e2b6cb966.cpp -o file16e2b6cb966.o 
> Erro em sourceCpp(code = code, env = env, rebuild = rebuild, showOutput = 
> showOutput,  : 
>  Error 1 occurred building shared library.

_______________________________________________
R-br mailing list
[email protected]
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça código 
mínimo reproduzível.

Responder a