[Rcpp-devel] Rcpp C++ code debug / Calling Rcpp in a C++ environment

Qiang Kou qkou at umail.iu.edu
Fri Jul 11 17:51:33 CEST 2014


I don't have a Windows developing environment just now, so I can not figure
out what is wrong. I can try in the weekends.

Just little personal advice.

(1) Maybe you should also put the compiling commands here, not only the
output. It may be easier to see your configuration and the problem.

(2) Since you want to debug in a pure C++ environment, why not remove all
the code related to R and Rcpp? As my personal habit, I develop and debug
pure C++ code first, then integrate with R.



On Wed, Jul 9, 2014 at 8:41 PM, Jing Peng <pengjing at live.com> wrote:

> 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
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Qiang Kou
qkou at umail.iu.edu
School of Informatics and Computing, Indiana University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140711/54d2062a/attachment.html>

More information about the Rcpp-devel mailing list