A while ago I tried compiling a simple C++ program that uses the multi_normal_lpdf function in the Stan Math library. I got some compiler errors from the Intel compiler and from the MSVC compiler. I managed to fix the Intel error, but not the MSVC one.
One of replies was,
I am coming back to this now because I would like to use another C++ library that is only compatible with MSVC.
So it would be nice to know whether you have made any progress in resolving the MSVC issues. I would be interested to know more the details of why this is an issue. The error messages that the compiler is giving me are not particularly enlightening.
Here is some source code that I am using as a test case,
#include <stan/math.hpp>
#include <iostream>
int main() {
Eigen::Matrix<double, Eigen::Dynamic, 1> y(3, 1);
y << 2.0, -2.0, 11.0;
Eigen::Matrix<double, Eigen::Dynamic, 1> mu(3, 1);
mu << 1.0, -1.0, 3.0;
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> Sigma(3, 3);
Sigma << 9.0, -3.0, 0.0, -3.0, 4.0, 0.0, 0.0, 0.0, 5.0;
std::cout << stan::math::multi_normal_lpdf(y, mu, Sigma);
return 0;
}
And here is the error message I get,
.../stan-dev/math/stan/math/rev/mat/functor/adj_jac_apply.hpp(410): fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'msc1.cpp', line 1518)
To work around this problem, try simplifying or changing the program near the locations listed above.
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Internal Compiler Error in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\cl.exe. You will be prompted to send an error report to Microsoft later.