#include <boost/math/common_factor.hpp> // included in BH
// ... etc.
Between the includes and the other functions, type
BH is a package that must be installed in R (install.packages(-) and library(-)) (so is Rcpp). Before each function in your .cpp file you need // [[Rcpp::export]] in a line by itself. This allows the function to be accessible from R. This syntax is for an *attribute* in C++.
See my file pvm.cpp (in the git .gist below) for an example of everything so far. Once the .cpp file is correctly written, use it from R as follows:
> library(BH); library(Rcpp)
That's all there is to it! More detailed information at the following links:
// - http://dirk.eddelbuettel.com/code/bh.html
// - http://gallery.rcpp.org/articles/a-first-boost-example/
// - After "which builds and runs..." at http://stackoverflow.com/questions/16131462/how-to-use-boost-library-in-c-with-rcpp