Here is a simple "Hello World" that can go into an endless compiler loop. It is not a freeze, but an seemingly endless loop of the compiler.
I am not compiling from a network. MinGW, Code::Blocks, and my code all exist on the same hard drive of my Windows7 computer.
The loop does not happen every time. And when it does it is because of a change within the MatrixStuff.cpp file or the MatrixStuff.h file.
To get the program to compile, I need to Abort and the Build again. Usually this results in a successful compile.
Main.cpp
#include <iostream>
#include "MatrixStuff.h"
using namespace std;
int main()
{
a(0,0)=1; a(0,1)=0; a(0,2)=0;
a(1,0)=0; a(1,1)=1; a(1,2)=0;
a(2,0)=0; a(2,1)=0; a(2,2)=1;
b(0,0)=1; b(0,1)=2; b(0,2)=3;
b(1,0)=4; b(1,1)=5; b(1,2)=6;
b(2,0)=7; b(2,1)=8; b(2,2)=9;
c=multiply(a,b);
cout << "Hello world!" << endl;
cout << c;
return 0;
}
MatrixStuff.cpp
#include "MatrixStuff.h"
Eigen::MatrixXd multiply (Eigen::MatrixXd, Eigen::MatrixXd)
{
return a*b;
}
MatrixStuff.h
#ifndef MATRIXSTUFF_H_INCLUDED
#define MATRIXSTUFF_H_INCLUDED
#include "Eigen/Dense"
Eigen::MatrixXd a(3,3);
Eigen::MatrixXd b(3,3);
Eigen::MatrixXd c(3,3);
Eigen::MatrixXd multiply (Eigen::MatrixXd, Eigen::MatrixXd);
#endif // MATRIXSTUFF_H_INCLUDED
I know this code is not the best example of coding style. All it does is multiply a matrix by an identity matrix. And it does that in the most convoluted way possible, which was necessary to demonstrate the problem.
To repeat, the compiler loop does not happen every time. And it only happens when h file (or the associated cpp file) that directly accesses Eigen is chaged.