[Rcpp-devel] registerPlugin("QuantLib",.....)

André de Boer rnieuws at gmail.com
Mon Jan 19 19:36:16 CET 2015


Hi,

I try to run this code in RStudio

// Original Klaus Spanderen  R/Finance 2013: Applied Finance with R
library(Rcpp)
library(inline)

registerPlugin("QuantLib",
  Rcpp:::Rcpp.plugin.maker(include.before='#include <ql/quantlib.hpp>',
                           libs="-lQuantLib"))

blackFormulaCall <- cxxfunction(
  signature(strike="numeric", fwd="numeric",
            stdDev="numeric", discount="numeric"),
  body='
    using namespace QuantLib;
    return wrap(blackFormula(Option::Call,
                             as<Real>(strike), as<Real>(fwd),
                             as<Real>(stdDev), as<Real>(discount)));',
  plugin="QuantLib")

But I get this error:

Error in compileCode(f, code, language = language, verbose = verbose) :
  Compilation ERROR, function(s)/method(s) not created! Warning message:
running command 'make -f "C:/PROGRA~1/R/R-31~1.2/etc/x64/Makeconf" -f
"C:/PROGRA~1/R/R-31~1.2/share/make/winshlib.mk"
SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)'
SHLIB="file29c067ef2ad7.dll" WIN=64 TCLBIN=64
OBJECTS="file29c067ef2ad7.o"' had status 127
In addition: Warning message:
running command 'C:/PROGRA~1/R/R-31~1.2/bin/x64/R CMD SHLIB
file29c067ef2ad7.cpp 2> file29c067ef2ad7.cpp.err.txt' had status 1

I have a working version of quantlib-1.4, but how do I tell the
compiler where to find it?

Thanks in advance,
André


More information about the Rcpp-devel mailing list