On 19 January 2015 at 19:36, André de Boer wrote: | 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?
Windows is, as usual, harder. On the other OSs, we can rely on quantlib-config. In RQuantLib we have this in Makevars.win: ## The environment variable QUANTLIB_ROOT has to point to an existing build of QuantLib ## With R 2.12.0 and later, we also support 32 and 64 bit builds and need to differentiate PKG_CXXFLAGS=-I$(QUANTLIB_ROOT) -I../inst/include -I. -I$(BOOSTLIB) $(SHLIB_OPENMP_CFLAGS) -fpermissive PKG_LIBS=-L$(QUANTLIB_ROOT)/lib${R_ARCH} -lQuantLib $(SHLIB_OPENMP_CFLAGS) I think you'd need to make up a Windows variant of the plugin. Note that there is also an rquantlib-devel mailing list... Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel