Hi everybody, Just now I was playing around with Rcpp in combination with Qt (I have found an excellent example on this). And decided to have a go(small dummyproject) at this myself. Problem is that the application segfaults when I run it. QtR.h http://pastebin.com/AXT144SK QtR.cpp http://pastebin.com/JUUuCFN2 main.cpp http://pastebin.com/yWUmDL17 mainwindow.cpp http://pastebin.com/gE84ZtxH I create an instance of my QtR class called qtr which creates an RInside session in the constructor. In my mainwindow.cpp I reference to my instance of qtr and then invoke the loadData method. In the loadData method I try to use m_R.parseEvalQ("cat("+fname_no_ext+"',file='outfile.txt',sep='\n')"); This results in a segfault. However when I remove this line from the loadData method and add the m_R.parseEvalQ("cat("+fname_no_ext+"',file='outfile.txt',sep='\n')"); line to the constructor of QtR which is invoked in main.cpp it runs without trouble. I probably am making a very obvious mistake. But I seem unable to see the issue at this point myself. Berry PS I have used pastebin for readability, or would everybody prefer the code within the e-mail? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130320/92ef3280/attachment.html>
[Rcpp-devel] Simple project segfaults
3 messages · Berry Kriesels, Dirk Eddelbuettel
8 days later
Hi again, Later on I realised I had made some fundamental programming errors resulting in the mentioned segfault entirely not related to rcpp. (fixed now by the way). I know that does not earn me many brownie points, so my apologies for my sloppy code. ;) Thus far I can say that I still really like the rcpp package and keep thinking of new ways I could use it. Berry
On 03/20/2013 11:15 PM, Berry Kriesels wrote:
Hi everybody, Just now I was playing around with Rcpp in combination with Qt (I have found an excellent example on this). And decided to have a go(small dummyproject) at this myself. Problem is that the application segfaults when I run it. QtR.h http://pastebin.com/AXT144SK QtR.cpp http://pastebin.com/JUUuCFN2 main.cpp http://pastebin.com/yWUmDL17 mainwindow.cpp http://pastebin.com/gE84ZtxH I create an instance of my QtR class called qtr which creates an RInside session in the constructor. In my mainwindow.cpp I reference to my instance of qtr and then invoke the loadData method. In the loadData method I try to use m_R.parseEvalQ("cat("+fname_no_ext+"',file='outfile.txt',sep='\n')"); This results in a segfault. However when I remove this line from the loadData method and add the m_R.parseEvalQ("cat("+fname_no_ext+"',file='outfile.txt',sep='\n')"); line to the constructor of QtR which is invoked in main.cpp it runs without trouble. I probably am making a very obvious mistake. But I seem unable to see the issue at this point myself. Berry PS I have used pastebin for readability, or would everybody prefer the code within the e-mail?
_______________________________________________ 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
-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130329/710490db/attachment.html>
Berry,
On 29 March 2013 at 10:24, Berry Kriesels wrote:
| Hi again, | | Later on I realised I had made some fundamental programming errors resulting in | the mentioned segfault entirely not related to rcpp. (fixed now by the way). | I know that does not earn me many brownie points, so my apologies for my sloppy | code. ;) Very much appreciate that you report back that it all works now. If you do have (public) samples somewhere, let us know. It is good to have more sample of R + Qt apps. | Thus far I can say that I still really like the rcpp package and keep thinking | of new ways I could use it. :) Submitting patches is next, right? Dirk
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com