# Error in compileCode without reinstalling

**URL:** <https://discourse.mc-stan.org/t/error-in-compilecode-without-reinstalling/29537>\
**Category:** Interfaces\
**Tags:** rstan\
**Created:** [November 19, 2022, 9:42am UTC](https://discourse.mc-stan.org/t/error-in-compilecode-without-reinstalling/29537 "2022-11-19T09:42:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elef](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/elef/32/4280_2.png) [@Elef](https://discourse.mc-stan.org/u/Elef)\
**Post date:** [November 19, 2022, 9:42am UTC](https://discourse.mc-stan.org/t/error-in-compilecode-without-reinstalling/29537/1 "2022-11-19T09:42:39Z")

</div>

Hi,

I think my error is from the “classics” and it seems that re-installing rstan could be a solution. However, my company is vetting **every** single package that I need to install. Then they through the installed folder in my library and this is how it works.

My question is if I can make the current rstan instalation to work.

The error I’m getting by running the following,

`R > example(stan_model, package = "rstan", run.dontrun = TRUE)` is

`Compilation ERROR, function(s)/method(s) not created! Error in compileCode(f, code, language = language, verbose = verbose) : C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file45cc4bb579e5.o:file45cc4bb579e5.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D0Ev[_ZN3tbb8internal26task_scheduler_observer_v3D0Ev]+0x1d): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file45cc4bb579e5.o:file45cc4bb579e5.cpp:(.text$_ZN3tbb10interface623task_scheduler_observerD1Ev[_ZN3tbb10interface623task_scheduler_observerD1Ev]+0x1d): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file45cc4bb579e5.o:file45cc4bb579e5.cpp:(.text$_ZN3tbb10interface623task_scheduler_observerD1Ev[_ZN3tbb10interface623task_scheduler_observerD1Ev]+0x3a): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file45cc4bb579e5.o:file45cc4bb579e5.cpp:(.text$_ZN3tbb10interface `

The makevars is

> CXX14FLAGS = -O3  
> CXX14 = (BINPREF)g++ -m(WIN) -std=c++1y  
> CXX11FLAGS = -O3  
> CXX14FLAGS += -mtune=native -march=native -Wno-ignored-attributes -Wno-deprecated-declarations

Also,

> R \> sessionInfo()  
> R version 4.2.1 (2022-06-23 ucrt)  
> Platform: x86\_64-w64-mingw32/x64 (64-bit)  
> Running under: Windows 10 x64 (build 19044)
> 
> Matrix products: default
> 
> locale:  
> [1] LC\_COLLATE=English\_United Kingdom.utf8 LC\_CTYPE=English\_United Kingdom.utf8  
> [3] LC\_MONETARY=English\_United Kingdom.utf8 LC\_NUMERIC=C  
> [5] LC\_TIME=English\_United Kingdom.utf8
> 
> attached base packages:  
> [1] stats graphics grDevices utils datasets methods base
> 
> other attached packages:  
> [1] rstan\_2.21.7 ggplot2\_3.4.0 StanHeaders\_2.21.0-7 RcppEigen\_0.3.3.9.3 Rcpp\_1.0.9
> 
> loaded via a namespace (and not attached):  
> [1] pillar\_1.8.1 compiler\_4.2.1 prettyunits\_1.1.1 tools\_4.2.1 pkgbuild\_1.3.1  
> [6] lifecycle\_1.0.3 tibble\_3.1.8 gtable\_0.3.1 lattice\_0.20-45 pkgconfig\_2.0.3  
> [11] rlang\_1.0.6 Matrix\_1.5-1 cli\_3.4.1 DBI\_1.1.3 rstudioapi\_0.14  
> [16] parallel\_4.2.1 loo\_2.5.1 gridExtra\_2.3 withr\_2.5.0 dplyr\_1.0.10  
> [21] generics\_0.1.3 fs\_1.5.2 vctrs\_0.5.1 stats4\_4.2.1 grid\_4.2.1  
> [26] tidyselect\_1.2.0 glue\_1.6.2 inline\_0.3.19 R6\_2.5.1 processx\_3.8.0  
> [31] fansi\_1.0.3 callr\_3.7.3 purrr\_0.3.5 magrittr\_2.0.3 codetools\_0.2-18  
> [36] matrixStats\_0.62.0 ps\_1.7.2 scales\_1.2.1 usethis\_2.1.6 assertthat\_0.2.1  
> [41] colorspace\_2.0-3 utf8\_1.2.2 RcppParallel\_5.1.5 munsell\_0.5.0 crayon\_1.5.2

Thanks for your time.

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [November 19, 2022, 10:04am UTC](https://discourse.mc-stan.org/t/error-in-compilecode-without-reinstalling/29537/2 "2022-11-19T10:04:51Z")

</div>

See the [Getting Started guide](https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows#r-42)

---

<div class="post-metadata">

**Author:** ![Elef](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/elef/32/4280_2.png) [@Elef](https://discourse.mc-stan.org/u/Elef)\
**Post date:** [November 20, 2022, 8:20pm UTC](https://discourse.mc-stan.org/t/error-in-compilecode-without-reinstalling/29537/3 "2022-11-20T20:20:38Z")

</div>

Oh I see now 😬  
So should it be the 2.26 or the latest version can do the job too?

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [November 20, 2022, 8:52pm UTC](https://discourse.mc-stan.org/t/error-in-compilecode-without-reinstalling/29537/4 "2022-11-20T20:52:27Z")

</div>

If you want to use R4.2 you’ll have to use rstan 2.26
