- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我又遇到这个错误了。但与以前不同的是,现在下面的测试有效:
fx <- inline::cxxfunction( signature(x = "integer", y = "numeric" ) , '
return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
' )
fx( 2L, 5 ) # returns 10 as should be
但是当我尝试基于 stan 的任何模型时(例如下面的示例代码和数据),我得到与下面相同的错误。
这里是示例数据和代码:
DT<-structure(list(c = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L), .Label = c("a", "b"), class = "factor"),
x = c(2004L, 2005L, 2006L, 2007L, 2008L, 2010L, 2012L, 2010L,
2012L, 2010L, 2005L, 2007L, 2012L, 2005L), y = c(11.05826397,
15.56776557, 49.50980392, 64.53900709, 75, 68.18181818, 99.86357435,
100, 99.26739927, 98.52941176, 100, 95.94594595, 99.64157706,
100)), class = "data.frame", row.names = c(NA, -14L))
library(brms)
fit <- brm(y~ x, data = DT)
它说“未创建函数/方法!”:
`Compiling the C++ model
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from C:/Users/.../Documents/R/win-library/3.5/BH/include/boost/config.hpp:39:0,
from C:/Users/.../Documents/R/win-library/3.5/BH/include/boost/math/tools/config.hpp:13,
from C:/Users/.../Documents/R/win-library/3.5/StanHeaders/include/stan/math/rev/core/var.hpp:7,
from C:/Users/.../Documents/R/win-library/3.5/StanHeaders/include/stan/math/rev/core/gevv_vvv_vari.hpp:5,
from C:/Users/.../Documents/R/win-library/3.5/StanHeaders/include/stan/math/rev/core.hpp:12,
from C:/Users/.../Documents/R/win-library/3.5/StanHeaders/include/stan/math/rev/mat.hpp:4,
from C:/Users/.../Documents/R/win-library/3.5/StanHeaders/include/stan/math.hpp:4,
from C:/Users/.../Documents/R/win-library/3.5/StanHeaders/include/src/stan
In addition: Warning messages:
1: In rstan::stan_model(model_code = x$model, save_dso = save_dso) :
StanHeaders version is ahead of rstan version; update to latest rstan
2: In system(cmd, intern = !verbose) :
running command 'C:/PROGRA~1/R/R-3.5.1/bin/x64/R CMD SHLIB file110c1cb656fa.cpp 2> file110c1cb656fa.cpp.err.txt' had status 1 `
这是我的 session 信息:
sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets
[6] methods base
other attached packages:
[1] rstudioapi_0.8.0.9000 brms_2.5.0
[3] ggplot2_3.0.0 Rcpp_0.12.19
loaded via a namespace (and not attached):
[1] mvtnorm_1.0-8 lattice_0.20-35
[3] gtools_3.8.1 zoo_1.8-4
[5] assertthat_0.2.0 digest_0.6.18
[7] mime_0.6 R6_2.3.0
[9] plyr_1.8.4 backports_1.1.2
[11] ggridges_0.5.1 stats4_3.5.0
[13] coda_0.19-2 colourpicker_1.0
[15] pillar_1.3.0 rlang_0.2.2
[17] lazyeval_0.2.1 miniUI_0.1.1.1
[19] Matrix_1.2-14 DT_0.4
[21] shinythemes_1.1.1 shinyjs_1.0
[23] stringr_1.3.1 htmlwidgets_1.3
[25] loo_2.0.0 igraph_1.2.2
[27] munsell_0.5.0 shiny_1.1.0
[29] rstan_2.17.4 compiler_3.5.0
[31] httpuv_1.4.5 pkgconfig_2.0.2
[33] base64enc_0.1-3 rstantools_1.5.1
[35] htmltools_0.3.6 tidyselect_0.2.5
[37] tibble_1.4.2 gridExtra_2.3
[39] threejs_0.3.1 matrixStats_0.54.0
[41] crayon_1.3.4 dplyr_0.7.6
[43] withr_2.1.2 later_0.7.5
[45] grid_3.5.0 nlme_3.1-137
[47] xtable_1.8-3 gtable_0.2.0
[49] magrittr_1.5 StanHeaders_2.18.0
[51] scales_1.0.0 stringi_1.1.7
[53] reshape2_1.4.3 promises_1.0.1
[55] bindrcpp_0.2.2 dygraphs_1.1.1.6
[57] xts_0.11-1 tools_3.5.0
[59] glue_1.3.0 markdown_0.8
[61] shinystan_2.5.0 purrr_0.2.5
[63] crosstalk_1.0.0 rsconnect_0.8.8
[65] abind_1.4-5 parallel_3.5.0
[67] inline_0.3.15 colorspace_1.3-2
[69] bridgesampling_0.5-2 bayesplot_1.6.0
[71] bindr_0.1.1 Brobdingnag_1.2-6
如果有任何解决此问题的想法,我将不胜感激。
最佳答案
brms
使用 Stan
提供适合贝叶斯模型的例程; Stan
又是一个 C++ 库,它提供了一种用于定义贝叶斯模型的概率语言。然后将这些模型用 Stan 语言解析并表达为 C++ 代码,然后将其编译为可执行程序。
简而言之,使用 brms
的关键要求之一是 C++ 编译器,它将您的模型编译成可执行程序。您的错误表明缺少后者。
来自 brms
GitHub FAQ :
Because brms is based on Stan, a C++ compiler is required. The program Rtools (available on https://cran.r-project.org/bin/windows/Rtools/) comes with a C++ compiler for Windows. On Mac, you should install Xcode. For further instructions on how to get the compilers running, see the prerequisites section on https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started.
您可以通过this link 直接安装Rtools
.
关于c++ - 编译错误,未创建函数/方法!对于 brms 模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49728978/
我已经使用 vue-cli 两个星期了,直到今天一切正常。我在本地建立这个项目。 https://drive.google.com/open?id=0BwGw1zyyKjW7S3RYWXRaX24tQ
您好,我正在尝试使用 python 库 pytesseract 从图像中提取文本。请找到代码: from PIL import Image from pytesseract import image_
我的错误 /usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS reference
我已经训练了一个模型,我正在尝试使用 predict函数但它返回以下错误。 Error in contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]])
根据Microsoft DataConnectors的信息我想通过 this ODBC driver 创建一个从 PowerBi 到 PostgreSQL 的连接器使用直接查询。我重用了 Micros
我已经为 SoundManagement 创建了一个包,其中有一个扩展 MediaPlayer 的类。我希望全局控制这个变量。这是我的代码: package soundmanagement; impo
我在Heroku上部署了一个应用程序。我正在使用免费服务。 我经常收到以下错误消息。 PG::Error: ERROR: out of memory 如果刷新浏览器,就可以了。但是随后,它又随机发生
我正在运行 LAMP 服务器,这个 .htaccess 给我一个 500 错误。其作用是过滤关键字并重定向到相应的域名。 Options +FollowSymLinks RewriteEngine
我有两个驱动器 A 和 B。使用 python 脚本,我在“A”驱动器中创建一些文件,并运行 powerscript,该脚本以 1 秒的间隔将驱动器 A 中的所有文件复制到驱动器 B。 我在 powe
下面的函数一直返回这个错误信息。我认为可能是 double_precision 字段类型导致了这种情况,我尝试使用 CAST,但要么不是这样,要么我没有做对...帮助? 这是错误: ERROR: i
这个问题已经有答案了: Syntax error due to using a reserved word as a table or column name in MySQL (1 个回答) 已关闭
我的数据库有这个小问题。 我创建了一个表“articoli”,其中包含商品的品牌、型号和价格。 每篇文章都由一个 id (ID_ARTICOLO)` 定义,它是一个自动递增字段。 好吧,现在当我尝试插
我是新来的。我目前正在 DeVry 在线学习中级 C++ 编程。我们正在使用 C++ Primer Plus 这本书,到目前为止我一直做得很好。我的老师最近向我们扔了一个曲线球。我目前的任务是这样的:
这个问题在这里已经有了答案: What is an undefined reference/unresolved external symbol error and how do I fix it?
我的网站中有一段代码有问题;此错误仅发生在 Internet Explorer 7 中。 我没有在这里发布我所有的 HTML/CSS 标记,而是发布了网站的一个版本 here . 如您所见,我在列中有
如果尝试在 USB 设备上构建 node.js 应用程序时在我的树莓派上使用 npm 时遇到一些问题。 package.json 看起来像这样: { "name" : "node-todo",
在 Python 中,您有 None单例,在某些情况下表现得很奇怪: >>> a = None >>> type(a) >>> isinstance(a,None) Traceback (most
这是我的 build.gradle (Module:app) 文件: apply plugin: 'com.android.application' android { compileSdkV
我是 android 的新手,我的项目刚才编译和运行正常,但在我尝试实现抽屉导航后,它给了我这个错误 FAILURE: Build failed with an exception. What wen
谁能解释一下?我想我正在做一些非常愚蠢的事情,并且急切地等待着启蒙。 我得到这个输出: phpversion() == 7.2.25-1+0~20191128.32+debian8~1.gbp108
我是一名优秀的程序员,十分优秀!