Visual Studio Compatibility


I was working with a client today who was using VSCode,, and was surprised to see that it recognized Stan files. There was no syntax highlighting, although there is an extension that provides that functionality, but it automatically uses the Stan logo for the tab icon.

This was neat and all but it raised a question – what is the status of template/Eigen/Stan compatibility with the msvc? I know there were problems a few years ago but I can’t seem to find reference current problems online. Have we abandoned the idea of msvc support on Windows just because the availability of rtools or have just not explored the most recent version of msvc?



That’s a good question. I think the last version I personally checked was MSVC 2010 and it didn’t work. Eigen says they’re compatible with MSVC 2012 and newer

For the Math library, you can compile as header-only if you exclude Sundials (so exclude integrate_ode_bdf(), but you can use integrate_ode_rk45()). That would be a good way to test whether it’s possible without having to complicate things by building a runtime library and linking against it.

We also had problems with compiling the Stan compiler with MSVC due to the heavy use of Boost’s templating. But I think that’s going to be a temporary problem until we shift to OCaml.

1 Like


If someone is interested in volunteering to check out this issue under Visual Studio 2017 (or whatever), compiling and trying to run PyStan’s tests is a relatively easy way to do it.

The appveyor build looks intimidating but you can ignore the anaconda bits and arrive at instructions on how to build and test PyStan (and by extension, Stan) using MSVC:



I think we could test this on Appveyor ourself.

small edits to .appveyor.yml (msvc 2017, remove libpython + m2w64-toolchain and gcc --version call) + enable pystan (fork) on appveyor.

My personal account is currently used for pystan testing, so maybe some other account?