Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Precompiling Eigen Headers

I am building a C++ project using Eclipse on Windows OS, I am also using the Eigen Linear Algebra library. My problem is with the very slow compiling time of Eigen (about 50 sec).

I've tried these proposed solutions:

  • Precompiled headers in Eclipse: unfortunately didn't work with me
  • The Amazing Ruby: Precompiled Header Hack for Eclipse CDT: it reduced the compiling time with 5 sec
  • #define EIGEN_NO_DEBUG: it reduced the time with additional 3 seconds

I really need a solution for this, it's very unpractical to wait 47 sec each time I build the project to test something.

Any idea is deeply appreciated, thanks.

like image 570
M.A. Avatar asked Nov 10 '22 15:11

M.A.


1 Answers

Eigen is a template library, meaning that the classes are defined based on the template parameters. I don't think that you would be able to precompile without letting the compiler know exactly all the possible classes you would need in your entire code base.

Alternatively, you could write a wrapper for Eigen and declare all the types you want and use that library. HOWEVER, you are likely to lose a lot of Eigen's advantages (see here, here and others).

like image 52
Avi Ginsburg Avatar answered Nov 15 '22 04:11

Avi Ginsburg