Reputation: 1149
In my app i'm performing following steps
1) Created a .h file Say, GlobalMacros.h
In GlobalMacros.h
#define IP_ADDR @“SERVER_IP”
2) In my apps .pch file
import “GlobalMacros.h”
Then in rest of the other classes i'm using this IP_ADDR macro in iOS<5.0 no Problems but in iOS>5.0 i'm getting an error use of undeclared identifier IP_ADDR
Upvotes: 3
Views: 2826
Reputation: 41642
The reason is one of these:
the .pch file
has some #if
test that conditionally includes #import "GlobalMacros.h"
if the build version is less than iOS5
the GlobalMacros.h
file has the conditional #if
in it
some header or source file has a #if
statement in it that undefines IP_ADDR
in the project that is less than iOS5, the .pch
file is using a different GlobalMacros.h
file, not the one that has the IP_ADDR
define in it
EDIT: I should add that in Xcode4.5
, I have this global macros file included in my .pch
file. For some reason, the preprocessor gets confused, and the source code editor is showing unknown macros in many files, seemingly at random. What I am doing is as I get errors, adding the global macros file to the affected file.
Upvotes: 3