Odeint with precompiled headers in Mingw fails

177 views Asked by At

I can't compile my project when I include <boost/numeric/odeint/integrate/integrate.hpp> in a precompiled header and compile using Mingw4.9.2-32bit (from Qt 5.4). The precompiled file is about 200 MB (huge!). The error message I get from the compiler is

Makefile.Debug:1698: recipe for target 'debug/main.o' failed
mingw32-make[1]: *** [debug/main.o] Error 1

From this related question PRECOMPILED HEADERS not working in debug build with Qt Creator / qmake / MinGw I understand that the reason for the compilation failure is because of the large size of the file. But! Why is this file so large? Is there a way to reduce the compiled header file size?

When I compile the code using MSVC 2013 I don't get this problem and the precompiled headers are about 40 MB (reasonable). When I compile in the MacOS 10.10 using clang I also don't get this problem.

In essence what I am trying to do is to speed up the compilation time when I use Odeint. If there are any other ways please let me know.

This is how my precompiled header looks like

// pre compiled header
#ifndef PCH_H
#define PCH_H

//-----------------------------------------------
// Add C includes here


//-----------------------------------------------
// Add C++ includes here

#ifdef __cplusplus

#include <boost/array.hpp>
#include <boost/numeric/odeint/integrate/integrate.hpp>
using namespace boost::numeric::odeint;

#endif //__cplusplus

#endif // PCH_H

Update I think the reason comes from the fact that boost and Odeint are heavily templated libraries and somehow the 32bit Mingw compiler (gcc underneath) can't handle that much sutff (?!?). Maybe a 64bit version of Mingw would work better? BTW, yesterday I tried the compilation process with the precompiled headers using clang on the Mac and the compilation succeeded as expected and the time of execution was fantastic: lest than 10 seconds for the first compile and then after the PCH was done it took less than 1 second to recompile for every iteration, on Windows with MSVC I get about 20 seconds for the first time and 10 seconds for recompilation, and of course on Mingw I can't even compile.

0

There are 0 answers