Abhinav
Abhinav

Reputation: 38162

importance of <ApplicationName>_prefix.pch file

What is the importance of importance of _prefix.pch file?

Upvotes: 5

Views: 964

Answers (1)

Jonathan Grynspan
Jonathan Grynspan

Reputation: 43472

Conceptually, it's included at the top of every translation unit (i.e. every compiled C, C++, Objective-C, or Objective-C++ file.) So you can force every file in your project to include a particular macro by adding this to your .pch file:

#if !defined(MY_MACRO)
    #define MY_MACRO (12345)
#endif /* !defined(MY_MACRO) */

And then MY_MACRO is always available. It's also commonly used to import framework headers so you don't have to run around typing #import <Foundation/Foundation.h> in every file.

Upvotes: 7

Related Questions