[Rcpp-devel] Rcpp C++ code debug / Calling Rcpp in a C++ environment
Jing Peng
pengjing at live.com
Thu Jul 10 02:41:45 CEST 2014
Hi All,
I am trying to debug the C++ code of an R package in a pure C++
environment. That way, I can put aside the interaction between R and C++.
However, I found I was not able to setup Rcpp properly after two days of
effort. I followed the following instructions for Eclipse and Netbeans,
respectively.
Eclipse:
http://stackoverflow.com/questions/12886517/how-to-set-up-eclipse-statet-rcpp-on-windows
Netbeans:
http://cdrv.wordpress.com/2012/11/12/setting-up-netbeans-to-work-with-rcpp-and-compiling-rcpp-code-for-beginners/
Test code:
#include <iostream>
#include <Rcpp.h>
using namespace std;
using namespace Rcpp;
int main(int argc, char** argv) {
cout<<"Hello World!"<<endl;
CharacterVector x = CharacterVector::create( "foo", "bar" ); // problem
occurs here
cout<<"Done!"<<endl;
return 0;
}
Platform: Windows 7 x64
I was able to build the code successfully in both Eclipse and Netbeans.
However, I can only see "Hello world" but not "done" from the console
output.
It seems that a problem occurred while calling the Rcpp function
CharacterVector::create, regardless of whether I had linked to Rcpp.dll.
Does anyone has any idea what's happening here, or any idea on how to
effectively debug the C++ code for an R package within an C++ IDE? I
actually had no problem calling the package in RStudio.
Thanks!
Jing
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140709/ce80c3f0/attachment.html>
More information about the Rcpp-devel
mailing list