Registered Member
|
Hi,
I tried to compile Eigen header files using this command: Eigen> find . -exec g++ -I ~/rvtests/third/eigen/ -MMD -O2 -msse2 -DNDEBUG -D__STDC_LIMIT_MACROS -x c++ -O2 -c {} \; >&/dev/null I checked that there are Eigenvalues.gch file. That means the pre-compiled header has been generated. Then I compile my C++ source code, g++ -MMD -O2 -msse2 -DNDEBUG -D__STDC_LIMIT_MACROS -c Skat.cpp -I../libsrc -I../third/eigen I found the compilation time is about the same, and g++ seems not picking up Eigen header. I wonder if anybody here use the pre-compiling technique can correct my error or demonstrate a working example. Thanks. |
Registered Member
|
The Eigen library is a header-only library. This means that when you compile your code all of Eigen's magic meta-programming must happen at source-compile time.
|
Registered Member
|
I understand Eigen will spend time on optimization.
But from this post: [url]viewtopic.php?f=74&t=96384&p=201640&hilit=compile+speed#p201961 [/url] There seems to be a way to speed compiling up. I wonder the details. |
Registered Member
|
Interesting to note -- surprises my first intuition. In this case I believe your issue is then probably better solved by asking this question on a GCC related forum. |
Moderator
|
Works here by generating the pch with: "g++ <your_options> -x c++-header path/to/Eigen/Eigen -o another/path/to/Eigen.gch" and to increase your chance that gcc does use the generated pch then compile your cpp files with "-include another/path/to/Eigen". Here I earn about 0.3s....
|
Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]