Cannot install Rstan for R 3.6.3

I am running into issues trying to install Rstan for R 3.6.3 and have scoured the forums but none of the proposed solutions are working for me.

System Info: Windows 11 Home
R: 3.6.3
Rstudio 2022.07.1
RTools 3.5

I followed the instructions in

and everything works fine.

Here is the output of some commands I have seen on the forums:

> readLines("~/.Renviron")
[1] "PATH=\"C:/Rtools/bin;${PATH}\""
> readLines("~/.Rprofile")
[1] "Sys.setenv(BINPREF = \"C:/Rtools/mingw_$(WIN)/bin/\")"
> readLines("~/.R/")
[1] ""                                                                                     " CXX14FLAGS += -mtune=native -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2"
> Sys.getenv("PATH")
[1] "C:/Rtools/bin;C:\\Program Files\\R\\R-3.6.3\\bin\\x64;C:\\Program Files (x86)\\Razer\\ChromaBroadcast\\bin;C:\\Program Files\\Razer\\ChromaBroadcast\\bin;C:\\windows\\system32;C:\\windows;C:\\windows\\System32\\Wbem;C:\\windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\windows\\System32\\OpenSSH\\;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR;C:\\Program Files\\dotnet\\;C:\\Program Files\\Git\\cmd;C:\\windows\\system32\\config\\systemprofile\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\rjtho\\go\\bin;C:\\Users\\rjtho\\scoop\\shims;C:\\Users\\rjtho\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\rjtho\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:/Program Files/RStudio/bin/quarto/bin"

When I follow the getting started instructions found

I end up getting the error

Error in .shlib_internal(args) : 
  C++14 standard requested but CXX14 is not defined

I have seen this error come up in other places on the forums, and have tried out many of the changes to makevars suggested, but none of those work.

Any help is appreciated.

I was able to get around this issue by getting our IT unit to install both R 4.2.2 and 3.6.3 on our devices and when I use 4.2.2 and corresponding version of Rtools it works fine (need to keep 3.6.3 around for connecting with our DB through ROracle). So this isn’t an ‘urgent’ problem that needs to be solved.
But would still be great to understand what is causing this issue for people on my team who don’t routinely need to run models or don’t want to manage bouncing between 2 versions of R.
Happy to delete this post though if we want to consider this solved.