Trouble running R code for fitting the model with Stan

Kindly help out with this Error that seems not to go despite restarts and re-installation of stan tools

Error in compileCode(f, code, language = language, verbose = verbose) : 
  C:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file1a3074ea599e.o:file1a3074ea599e.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D0Ev[_ZN3tbb8internal26task_scheduler_observer_v3D0Ev]+0x1d): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file1a3074ea599e.o:file1a3074ea599e.cpp:(.text$_ZN3tbb10interface623task_scheduler_observerD1Ev[_ZN3tbb10interface623task_scheduler_observerD1Ev]+0x1d): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file1a3074ea599e.o:file1a3074ea599e.cpp:(.text$_ZN3tbb10interface623task_scheduler_observerD1Ev[_ZN3tbb10interface623task_scheduler_observerD1Ev]+0x3a): undefined reference to `tbb::internal::task_scheduler_observe
Error in sink(type = "output") : invalid connection

Thanks,
Aruho

this error message indicates that you’re on Windows and that there’s a problem with building the threading library TBB. perhaps @rok_cesnovar can help you.