4

I'm trying to use Boost together with Rcpp as in this example by Dirk Eddelbuettel. I cannot, however, compile this example as I get

"fatal error: 'boost/math/common_factor.hpp' file not found". 

I have looked at this question and done item 1 and 2 in the list of suggestions by Dirk. Especially, when doing 1 it seems that I can build a C++ program utilizing the boost library. Furthermore, on my MacBook it seems like Boost is located in the directory /opt/local/include/.

Regarding number 3 in the list of suggestions it is not clear to me what exactly to put in the makevars file though. Any Ideas?

Adam

Community
  • 1
  • 1
Adam
  • 87
  • 5

2 Answers2

3

boost/math/common_factor.hpp does not seem to be part of BH, so item 4 can be ruled out. If you have boost headers installed in /opt/local/include, for item 3, you can do something like this perhaps:

 PKG_CXXFLAGS += -I/opt/local/include
Romain Francois
  • 17,432
  • 3
  • 51
  • 77
  • Thanks! Seems to work. I had previously tried PKG_CXXFLAGS=-I /opt/local/include/. What is the difference? Also, I am actually interested in sampling from the inverse gamma and the truncated normal distribution. As they are not standard in R they seem to be unavailable when using Rcpp. This is where Boost comes in. – Adam Dec 27 '13 at 22:08
0

If you have difficulties instructing the compiler to find a complete Boost installation, you could always switch to another example from the Rcpp Gallery as eg

both of which should work with a // [[Rcpp::depends(BH)]].

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725