PRECOMPILED HEADERS not working in debug build with Qt Creator / qmake / MinGw

。_饼干妹妹 提交于 2019-12-01 07:07:47

I have (probably) run into the same problem and took some time to find out what is going on.

After some fiddling around to create an MWE I found, that the size of the .pch file seems to be crucial for this problem.

Using a PCH that is greater than 128 MB aborts the compilation without any message and returns code 1 (instead of 0 for succesful compilation).

My findings resemble the problem stated in this GCC mailing list entry.

It seems the only way to get it working is to reduce the size of the PCH file below 128 MB.

Just for the record: I am using a QMake project from Qt 5.2.1 and the included MinGW (rev2) gcc 4.8.0 32bit on WinXP 32bit and Win 8 64bit.

On the other hand my GCC 4.8.2 64bit under linux ate a ~5GB PCH file without complaints (I would have tested a bigger one but compiling this one nearly exceeded my RAM).

Digging deeper

I generated a header file to use as PCH with following contents:

class _1 {};
class _2 {};
class _3 {};
class _4 {};
class _5 {};
class _6 {};
class _7 {};
class _8 {};
class _9 {};
class _10 {};
//...

Using binary search (for the number of classes in this file) I found that filling this file with 128273 classes results in a generated PCH file that has a size of 135266564 bytes and can be used during compilation of other files. Using 128274 classes the generated PCH file has a size of 135270660 bytes and compilation using this PCH fails.

I am not sure what to do with this information. Not giving an error message is definitely wrong but I don't know who is to blame (GCC (version?), MinGW/Windows, 32bitness).

Maybe someone with more time at hand can decide and inform the right people?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!