Problem stan installation

Hi,
with an R actualization stan stopped working. I read it is not working well in R.4.2 version so I uninstalled R and downloaded the R.4.0 version, which seemed to work ok.
However, when I try to install stan problems persist.
I have followed the subsquent steps
Sys.getenv(“BINPREF”) and it was ok “” (output)
Then I installed Rtools from Using Rtools4 on Windows
and verified it with
Sys.which(“make”)
with the output : “C:\rtools40\usr\bin\make.exe”. So I assumed it was ok
Then, I installed install.packages(“jsonlite”, type = “source”). Which was ok.

However when I try
install.packages(“rstan”, repos = “https://cloud.r-project.org/”, dependencies = TRUE)
It does not install, it provides a long text with a lot of errors and does not finish anything. I stopped the process after 30 min.
This is the begining of the text
"Installing package into ‘C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL ‘https://cran.rstudio.com/src/contrib/rstan_2.21.7.tar.gz
Content type ‘application/x-gzip’ length 1169333 bytes (1.1 MB)
downloaded 1.1 MB

  • installing source package ‘rstan’ …
    ** package ‘rstan’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs

*** arch - i386
“C:/rtools40/mingw32/bin/“g++ -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.0/include” -DNDEBUG -I”…/inst/include" -I"…/inst/include/boost_not_in_BH" -I"." -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -DBOOST_NO_AUTO_PTR -DSTAN_THREADS -DRCPP_PARALLEL_USE_TBB=1 -I’C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/Rcpp/include’ -I’C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/RcppEigen/include’ -I’C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/BH/include’ -I’C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/StanHeaders/include’ -I’C:/Users/tmora/OneDrive/Documentos/R/win-library/4.0/RcppParallel/include’ -DRCPP_PARALLEL_USE_TBB=1 -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -mtune=native -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -c Module.cpp -o Module.o"

I have been reading other parts of the forum but could not find a solution. Quite desperate right now…

Looking forward to your reply, many thanks in advance
Tere