5

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:

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.

Angew is no longer proud of SO
  • 167,307
  • 17
  • 350
  • 455
M.A.
  • 169
  • 1
  • 1
  • 18
  • Precompiled header support is compiler-specific. Which compiler & version are you using? And what exactly didn't work from the first link? – Angew is no longer proud of SO Apr 16 '15 at 09:03
  • @Angew. I am using Cygwin C++ Compiler -g3. Regarding the first link, I did my best to follow it but it gave me no results, nothing changed, I might have done a mistake in the step where it says "Then go to the miscellaneous option select the release configuration and add ... ". I wasn't sure how to construct my path in that shape. – M.A. Apr 16 '15 at 09:26

1 Answers1

2

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).

Community
  • 1
  • 1
Avi Ginsburg
  • 10,323
  • 3
  • 29
  • 56
  • 1
    It *is* possible to use precompiled headers to speed up template compilation, at least with compiler which do two-phase name lookup properly. It may not speed up the instantiation,but it will still save on the parsing. And with template code, there's usually a lot of parsing involved. – Angew is no longer proud of SO Apr 16 '15 at 09:38
  • @Angew Fair enough. However, the second point is still valid, albeit dangerous for performance due to the loss of expression templates. – Avi Ginsburg Apr 16 '15 at 10:02