#define in 'user-defined' section of target build settings, is not defined when xcode compiles code
-
13-07-2021 - |
Question
I have a project, using the current version of Xcode and llvm.
I am doing a free and paid version of a game, so I have set up a preprocessor flag to do it.
For the paid version target I define PAID_VERSION = 1
(in the "User-Defined" section of Build Settings)
When I compile however the PAID_VERSION
keeps coming up with undefined.
So my #ifndef
and #ifdef
directives build the free version of the app.
I have looked around Stack Overflow and Google and found no hints as to what is going on here.
Solution
In the Other C Flags section add -DPAID_VERSION=1
This will define PAID_VERSION
as 1
, equivalent to #define PAID_VERSION 1
in code.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow