[Rcpp-devel] Embedding RInside in C++ project

Dirk Eddelbuettel edd at debian.org
Thu Jul 23 16:15:58 CEST 2015


Hi Ulf,

On 23 July 2015 at 15:53, Ulf Mertens wrote:
| I am working on a project in C++ where I have to use Bayesian Statistics quite
| extensively. I coded my own Metropolis Hasting Sampler but since it is not
| working that well, I wanted to call rstan from within C++ via RInside. I
| already wrote the appropriate RInside/Rcpp code but I don't know how to rewrite
| my CMakeLists.txt file to make it work.

Sounds nice. Will you release this?
 
| I looked at the CMakelists.txt file in the standard/examples folder but I don't
| know enough about cmake to rewrite it for my own project.
| 
| My project consists of 3 source files and 2 header files and I am working with
| Eclipse Mars. Here is my current file:
| 
| cmake_minimum_required(VERSION 2.6)
| 
| project(XX)
| 
| # use C++11
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
| 
| add_executable(${PROJECT_NAME}
|   global.h
|   model.h
|   model.cpp
|   run.cpp
|   mcmc.h
|   mcmc.cpp
|   )
| 
| What do I have to change (in the file or in Eclipse itself) to make it work?

I wrote and support the 'plain old Makefile(s)' and can help with this.

CMake support was added by Peter (CC'ed) who may be able to help you with this.
My usual approach for 'non-Make' builds is to make it work with make, and
then carry the changes over.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list