cpttrend.cpp:142:27: error: 'PI' was not declared in this scope
Hi,
Hope this email finds you well. I hope to install R package "techchart". I have followed all instruction like installed the Rtools and devtools before running the devtools::install_github("prodipta/techchart"). However I got the following error when running the code:
Downloading GitHub repo prodipta/techchart@HEAD ── R CMD build ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── checking for file 'C:\Users\ewind\AppData\Local\Temp\RtmpE1JDB4\remotes8d8840ac4eca\prodipta-techchart-93f9106/DESCRIPTION' ... checking for file 'C:\Users\ewind\AppData\Local\Temp\RtmpE1JDB4\remotes8d8840ac4eca\prodipta-techchart-93f9106/DESCRIPTION' ... ✔ checking for file 'C:\Users\ewind\AppData\Local\Temp\RtmpE1JDB4\remotes8d8840ac4eca\prodipta-techchart-93f9106/DESCRIPTION' (352ms) ─ preparing 'techchart': checking DESCRIPTION meta-information ... checking DESCRIPTION meta-information ... ✔ checking DESCRIPTION meta-information ─ cleaning src ─ checking for LF line-endings in source and make files and shell scripts ─ checking for empty or unneeded directories ─ building 'techchart_0.1.0.tar.gz'
Installing package into ‘C:/Users/ewind/AppData/Local/R/win-library/4.3’ (as ‘lib’ is unspecified)
- installing source package 'techchart' ... ** using staged installation ** libs using C++ compiler: 'G__~1.EXE (GCC) 12.2.0' g++ -std=gnu++17 -I"C:/PROGRA~1/R/R-43~1.1/include" -DNDEBUG -I'C:/Users/ewind/AppData/Local/R/win-library/4.3/Rcpp/include' -I"c:/rtools43/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c RcppExports.cpp -o RcppExports.o g++ -std=gnu++17 -I"C:/PROGRA~1/R/R-43~1.1/include" -DNDEBUG -I'C:/Users/ewind/AppData/Local/R/win-library/4.3/Rcpp/include' -I"c:/rtools43/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c cpttrend.cpp -o cpttrend.o cpttrend.cpp: In function 'double ols_llk(Rcpp::NumericVector, Rcpp::NumericVector, long int)': cpttrend.cpp:142:27: error: 'PI' was not declared in this scope 142 | ret = double(n)/2log(2PI) + double(n)/2*log(variance) + double(n)/2; | ^~ make: *** [C:/PROGRA~1/R/R-43~1.1/etc/x64/Makeconf:272: cpttrend.o] Error 1 ERROR: compilation failed for package 'techchart'
- removing 'C:/Users/ewind/AppData/Local/R/win-library/4.3/techchart' Warning message: In i.p(...) :
From my understanding of the error description, seems the PI was not defined in the c++. Please could you shed some light about if I have done things wrong with the installation? Thank you very much.
download the code, replace PI with M_PI and use devtools::install_local()