1

I am working on an application where i have to use several constants.I want to declare all those constants in one single .h file.Can any one suggest me a way to achieve this. Thanks in advance.

Hariprasad
  • 1,094
  • 2
  • 12
  • 30

2 Answers2

5

You can define all required header files and constants in the ProjectName_Prefix.pch(located under the Other Sources folder of your project) file.In this way you are not required to declare the libraries,constants required in multiple classes.

Cheers

Aditya
  • 4,414
  • 5
  • 29
  • 40
2

create constants.h put all you constants into it and #import "constants.h" in your Prefix.pch

or if you don't want to recompile the whole project if you change something in constants.h just import the file in the sourcefiles where you need it. The latter approach saves a lot of time if you use an old mac mini for development on a project which has 200MB of png files.

Matthias Bauch
  • 89,811
  • 20
  • 225
  • 247