My code has been taking a long time to compile (around 10 minutes). I removed parts of the code to identify the problem, until all that was left was the declaration the global variable Znodal[dim3][dim3] and the main function with hello world code.
I noticed that when removing the complex array Znodal[dim3][dim3] the compile time goes back to normal, taking 0.81 seconds to compile. Therefore, the problem seems to be related to the complex number library. However, this code ran normally on another computer. So, it looks like it's a compiler configuration issue.
Has anyone had a similar problem or can give me some tips to solve this problem?
The code below takes 10 minutes to compile on my laptop.
#include <complex>
#define dim3 435
std::complex<double> Znodal[dim3][dim3];
#if 0
#include <iostream>
int main() {
std::cout << "Hello World!\n";
return 0;
}
#endif
A 1D array of the same size (std::complex<double> Znodal[dim3][dim3];
) takes a similarly long time to compile with this version of MSVC. (Testing on Godbolt shows MSVC 19.14 through 19.24 compiled quickly as expected for a zero-init array, with default options and -O2
optimization level, but MSVC 19.25 and later are so slow they time out. The long compile times led to MS's servers blocking requests temporarily so it's hard to experiment with; the Godbolt compiler explorer bounces requests to MS's servers for MSVC other than the WINE install.)
My laptop setup is IdeaPad Gaming 3 15IMH05, I5-10300H, CPU 2.5GHz, 16GB RAM, SSD 500GB WD Blue SN570, M.2 2280, NVMe, GTX 1650, Windows 10 Home Single Language, version 22H2.
Microsoft Visual Studio Community 2022 (64 bits) - Version 17.6.2.