Rstan error message (cannot complie the 8 scholl example)

Hi all,

Recently my Rstan does not work normally. When I tried to re-do some previous analysis, there is some error message like ‘parser failed’. Then I tried to reinstall rstan and now even the 8-school example does not work for me with the following error message:

R code:

library("rstan") # observe startup messages
options(mc.cores = parallel::detectCores())
rstan_options(auto_write = TRUE)
schools_dat <- list(J = 8, 
                    y = c(28,  8, -3,  7, -1,  1, 18, 12),
                    sigma = c(15, 10, 16, 11,  9, 11, 10, 18))

fit <- stan(file = 'schools.stan', data = schools_dat)

Error output:

> fit <- stan(file = 'schools.stan', data = schools_dat)
make cmd is
  make -f "C:/PROGRA~1/R/R-42~1.1/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-42~1.1/share/make/winshlib.mk" CXX='$(CXX14) $(CXX14STD)' CXXFLAGS='$(CXX14FLAGS)' CXXPICFLAGS='$(CXX14PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX14LDFLAGS)' SHLIB_LD='$(SHLIB_CXX14LD)' SHLIB="file3aa46d5c70ef.dll" WIN=64 TCLBIN= OBJECTS="file3aa46d5c70ef.o"

make would use
if test "zfile3aa46d5c70ef.o" != "z"; then \
  if test -e "file3aa46d5c70ef-win.def"; then \
    echo g++  -shared -s -static-libgcc -o file3aa46d5c70ef.dll file3aa46d5c70ef-win.def file3aa46d5c70ef.o  -L"C:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64" -L"C:/rtools42/x86_64-w64-mingw32.static.posix/lib"  -L"C:/PROGRA~1/R/R-42~1.1/bin/x64" -lR ; \
    g++  -shared -s -static-libgcc -o file3aa46d5c70ef.dll file3aa46d5c70ef-win.def file3aa46d5c70ef.o  -L"C:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64" -L"C:/rtools42/x86_64-w64-mingw32.static.posix/lib"  -L"C:/PROGRA~1/R/R-42~1.1/bin/x64" -lR ; \
  else \
    echo EXPORTS > tmp.def; \
    nm file3aa46d5c70ef.o | sed -n 's/^.* [BCDRT] / /p' | sed -e '/[.]refptr[.]/d' -e '/[.]weak[.]/d' | sed 's/[^ ][^ ]*/"&"/g'  >> tmp.def; \
    echo g++  -shared -s -static-libgcc -o file3aa46d5c70ef.dll tmp.def file3aa46d5c70ef.o  -L"C:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64" -L"C:/rtools42/x86_64-w64-mingw32.static.posix/lib"  -L"C:/PROGRA~1/R/R-42~1.1/bin/x64" -lR ; \
    g++  -shared -s -static-libgcc -o file3aa46d5c70ef.dll tmp.def file3aa46d5c70ef.o  -L"C:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64" -L"C:/rtools42/x86_64-w64-mingw32.static.posix/lib"  -L"C:/PROGRA~1/R/R-42~1.1/bin/x64" -lR ; \
    rm -f tmp.def; \
  fi \
fi
Error in compileCode(f, code, language = language, verbose = verbose) : 
  C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file3aa46d5c70ef.o:file3aa46d5c70ef.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: file3aa46d5c70ef.o:file3aa46d5c70ef.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: file3aa46d5c70ef.o:file3aa46d5c70ef.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: file3aa46d5c70ef.o:file3aa46d5c70ef.cpp:(.text$_ZN3tbb10interface
Error in sink(type = "output") : invalid connection

See the Getting Started guide