I am hoping to reuse the date and calendar function in Quantelb in my R code. Since not all calendars are included in RQuantLib, I have compiled and installed the latest Qantib version. However, I fail to run the example given in a How do I configure Rcpp to properly compile and use C ++ code?
I tried to run the following code (in the "myCode.cpp" file) using the RCP function sourceCpp ("myCode.cpp"):
# Include & lt; ql / quantlib.hpp & gt; #include & lt; Rcpp.h & gt; Namespace using RCPP; // [[RCPP: Dependent (quake leak)]] [[RCPP :: Export]] Twice (Double X) {Quantlib :: Calendar Merkel = Quant Lib :: United Kingingman (Quant) Leib :: Date New Year (31, Quant Lib :: December, 2008); Quant Lib :: R Results zc3mQuote = x; return zc3mQuote * 2;}
Results on the following errors:
ld: Warning: Options' -L / USR / Local / Lib / GCC / I686-apple-darwin8 / 4.2.3 / x86_64 'ld: Warning: The directory for the option' -L / usr / local / lib / x86_64 'is not found: Warning: Option' -L Library for USR / local / Lib / gcc / i686-apple-darwin8 / 4.2.3 'ld: -lgfortran not found clag: error: linker failed with command failure code 1 (for inventions -V Use it ): *** [sourceCpp_65848.so] Error 1
Things work fine when compiling the file "myCode.cpp" on the command line:
< Code> G ++ -i / opt / local / included / -i / opt / local / included / boost / -i / library / framework / r. framework / resource / included -DNDEBUG \ -i / opt / local / include -i / opt / local / include-I / usr / local / include \ -i "/ library / framework / r.framework / version / 3.1 / resource / library / rcpt / include" \ -i "/ library / framework / R. Frame Add / Version / 3/1 / Resources / Library / Reconstruction Lib / Include "\ -fPIC -mtune = c Ore2 -g -O2 -c QuantLibTest2.cpp- o Quant Libertost 2.O \ L / opt / Local / Lib / - A QUALITY LIB
Have you used cranial sources, Or what's in GitHub?
It seems that the "no Windows" branch in setup requires some work. It currently does
## on Linux and OS X; Near Quantelb-config, which may be incorrect ## in the case of prebuild binary packages such as R-Cran-Raktalib # # Debian / Ubuntu, as well as the OS X package from CRAN qc & lt; - System ("bash -c 'type-p quiltb-config' ', ignored.steder = TRUE, intern = TRUE) if (is .cc) & amp; amp; amp; amp; nchar (qc) & gt; 1) {qlcflags & lt; - system (paste (qc, "- cflags"), intern = TRUE} qllibs & lt; - system (paste (qc, "--libs"), intern = TRUE)}
Is quantlib-config
in your path, and does it return the correct value?
I will enable you to do / Expanded Support - Use the AQUQUET LEB in the RQPL plugin in the last few days, so please be worried Do not try Geethaub sources. They work fine on Linux, but I have no OS X system to test.
Edit: To accept the answer For completion, your original code works as as on your box using RQuantLib from GitHub sources:
R> System ("cat /tmp/rql.cpp ") #include & lt; ql / quantlib.hpp & gt; # Include & lt; Rcpp.h & gt; Using namespace RCPP; // [[RCPP: Dependent (RQP):] [/] [[RCPP :: Exports]] Twice (Double X) {Qantlib :: Calendar Mykel = Quant Lib :: United Kingingman; Quant Leib :: Date New Year's Eve (31, Quant Lib :: Dec., 2008); Quant Lib :: Rate zc3mQuote = x; Return zc3mQuote * 2; } R & gt; SourceCpp ("/ tmp / rql.cpp") #S few seconds R & gt; Takes To Times (21) [1] 42 R & gt;
Comments
Post a Comment