使用R 3.6.0编译stan文件时出错.并赢得10 [英] Error on the stan file compilation using R 3.6.0. and Win 10

查看:824
本文介绍了使用R 3.6.0编译stan文件时出错.并赢得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脚本来克服问题,但在我的情况下不起作用:

Some non-English page said that we can overcome by executing the following R script, but it did not work in my case:

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脚本与以下页面相同:

The above R script is same as in the following page:

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

我尝试根据以下页面进行卸载和安装,但是发生了以上错误.

I tried to uninstall and install according to the following page, but the above error occurred.

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

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

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

推荐答案

对我来说,此问题已通过在文件.R/Makevars.win中手动添加以下行来解决.

For me, the issue has been solved by adding manually the following line into the file .R/Makevars.win.

CXX14 = "C:\Rtools\mingw_64\bin\g++.exe"

这篇关于使用R 3.6.0编译stan文件时出错.并赢得10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆