Xcode, icc, and precompiled headers

Xcode, icc, and precompiled headers

I'm a long time user of icc (dating back to the first version for OS X) and I've never gotten precompiled headers to work with icc and Xcode.  What exactly are we supposed to do?

When using the default compiler in Xcode, all I have to do is enable precompiled headers and set the filename of the prefix header.  In the prefix header, I include my commonly used headers.  This works just fine whenever I build with clang (and in the past, gcc).

However, when I enable Precompile Prefix Header in the Intel C++ Compiler XE 14.0 settings and set the compiler to icc in my project, prefix.h is compiled with every file in my project which more than doubles my compile time.

So what are we supposed to do in the project settings in Xcode to get precompiled headers working when compiling with icc?

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.


Thanks for this report. 
This is a known problem that will be fixed in one of upcoming Composer XE 2015 Beta updates.
Meanwhile you can consider using -pch or related flags (http://software.intel.com/en-us/node/460156). 
Thanks for your patience.


My point is that this has never worked with any version of icc and Xcode that I've tried.  Never ever and I've been an icc user since around 2006.

I found it hard to believe that it has never worked so I figured I was doing something wrong. I've always ignored it but the speed difference between icc and clang has become more and more noticeable to the point that one icc build takes more time than my 4 other clang builds combined (all builds are from same source, just different product limits).

I finally found "Using Precompiled Header Files" in the documentation and now understand what icc is doing with PCH.  I was expecting more of the VS/Xcode style of doing PCH but now see that icc doesn't work like that at all.



chinhster wrote:

I was expecting more of the VS/Xcode style of doing PCH but now see that icc doesn't work like that at all.

Actually it does (though it is not documented well). ICC accepts '-x c-header' or '-x c++-header' filetypes (http://software.intel.com/en-us/node/460346) and creates precompiled header .pchi that can be consumed later when '-include <header.h>' is specified on the command line - just like Apple compiler does in Xcode. There is a known issue with Xcode integration tool that prevents it from effective use of the precompiled prefix header and it will be fixed in one of beta updates for the C++ Composer 15.0.


Leave a Comment

Please sign in to add a comment. Not a member? Join today