使用 R 3.6.0 编译 stan 文件时出错。并赢得 10

Error on the stan file compilation using R 3.6.0. and Win 10

Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! Error in .shlib_internal(commandArgs(TRUE)) : 
  C++14 standard requested but CXX14 is not defined
Calls: <Anonymous> -> .shlib_internal
Execution halted
In addition: Warning message:
In system(cmd, intern = !verbose) :
  running command 'C:/PROGRA~1/R/R-36~1.0/bin/x64/R CMD SHLIB file1a1860a0379.cpp 2> file1a1860a0379.cpp.err.txt' had status 1
Error in sink(type = "output") : invalid connection

一些非英文页面说我们可以通过执行以下R脚本来克服,但它在我的情况下不起作用:

dotR <- file.path(Sys.getenv("HOME"), ".R")
if (!file.exists(dotR)) 
  dir.create(dotR)
M <- file.path(dotR, "Makevars")
if (!file.exists(M)) 
  file.create(M)
cat("\nCXX14FLAGS=-O3 -Wno-unused-variable -Wno-unused-function",
    "CXX14 = g++ -std=c++1y",
    file = M, sep = "\n", append = TRUE)

以上R脚本与下页相同:

https://github.com/stan-dev/rstan/issues/569


我尝试按照下面的页面进行卸载和安装,但是还是出现了上面的错误

Rstan 安装:https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started

REF; https://github.com/stan-dev/stan/issues/1613

参考:https://github.com/stan-dev/rstan/issues/633

对我来说,通过手动将以下行添加到文件 .R/Makevars.win.

中,问题已得到解决
CXX14 = "C:\Rtools\mingw_64\bin\g++.exe"