KayEss
KayEss

Reputation: 2300

Objective-C++ pre-compiled headers

I'm using a C++ library (it happens to be in an iPad application, but I'm not sure that should make any difference) and would really like to have the headers pre-compiled to speed up the builds, but xCode seems to run the pre-compiled header file through the C compiler rather than the C++ one.

Is there a way to get it to use the right compiler? I've already changed all of my source files from .m to .mm.

Upvotes: 4

Views: 2098

Answers (1)

JeremyP
JeremyP

Reputation: 86651

According to the Xcode docs, a compiled header is generated for each language variant. So if you bracket your #include with guard macros, it should work i.e.

#if defined __cplusplus
#include "mycplusplusheader.h"
#endif

Upvotes: 7

Related Questions