<div dir="ltr">Hi All,<div><br></div><div>I have a C++ class that I build and test without the help of Rcpp. </div><div><br></div><div>I use Rcpp as an interface, inputting and outputting data from and to the class. I'm stuck at the outputter. Ideally I would like to have this at the end of my program:</div>

<div><br></div><div>Rcpp::List Results = MyClass.ExportToR();</div><div><br></div><div>where ExportToR is a method that creates an Rcpp::List from members of MyClass. However, I'm unable to use components of Rcpp.h in my code; In particular, I'm unable to make this toy example work:</div>

<div><br></div><div><div>#include <iostream></div><div>#include <cstdlib></div><div>#include <blitz/array.h></div><div>#include <Rcpp.h></div><div>#include <R.h></div><div><br></div><div>using namespace std;</div>

<div><br></div><div>int main(int argc, char *argv[])</div><div>{</div><div><span class="" style="white-space:pre">    </span>   Rcpp::IntegerVector d;</div><div><br></div><div><span class="" style="white-space:pre"> </span>   // Rcpp::List L; want to use</div>

<div><span class="" style="white-space:pre">    </span>   // L to output results to R.</div><div><br></div><div><span class="" style="white-space:pre">   </span>  return EXIT_SUCCESS;</div><div>}</div></div><div><br></div><div>

I compile it with</div><div><br></div><div>llvm-g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -W -I/usr/local/include -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include" -L"/Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/lib/" -L"/Library/Frameworks/R.framework/Versions/3.0/Resources/lib" export.cpp -lRcpp -lR -o  export<br>

</div><div><br></div><div>which compiles, but produces a segfault.</div><div><br></div><div>Thanks for any help!</div><div><br></div><div>Florian</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br>
</div>
<div><br></div></div>