Cannot resolve the "cannot allocate vector of size … " error

In this thread, you said

On the other hand, in the first post in the thread, it is described

CXX14 = C:\Rtools\mingw64\bin\g++ -m$(WIN)

I am comfused…

Now, Stan works.
My Makevars.win file in the file .R is the following.

CXX14 = C:/Rtools/mingw64/bin/g++

CXX14 = C:/rtools40/mingw64/bin/g++ -m$(WIN) -v
CXX14FLAGS += -mtune=native -march=native -Wno-ignored-attributes -Wno-deprecated-declarations

I was comfused the code
CXX14 = C:/Rtools/mingw64/bin/g++

with

CXX14 = C:/rtools40/mingw64/bin/g++ -m$(WIN) -v
and I guess it is the reason why Stan does not work.

Anyway,
Thank you.