XCode Multiple Targets question

Posts: 7
Joined: 2008.06
Post: #1

I have two targets defined in XCode (one for free app, the other for full).

in my application logic, I want to use something like

// display ads

or something similar, is there I way I could specify some variables for targets like this? (I tried using header files, can't use them, XCode pulls value from the header that it finds using its on search mechanism, doesn't care for which header file is included in the target's "Copy Resources" group).

Quote this message in a reply
Posts: 1,563
Joined: 2003.10
Post: #2
A few things:
  • You can define compile-time constants with the -D argument to gcc (like gcc -DFREE_VERSION_OF_MY_APP or gcc -DFREE_VERSION_OF_MY_APP=1).
  • When you #include or #import a header file, gcc searches through your defined header search paths (somewhat differently if you use <foo.h> vs. "foo.h") and essentially pastes the contents of the first one it finds into your source file in place of the #include statement. If you want to include different headers for different targets, you could pass different header search paths to each.
  • Header files are not resources. There's no (non-esoteric) reason to ever include them with your built executable. Always leave them out of the Copy Resources group.
Quote this message in a reply
Posts: 3,591
Joined: 2003.06
Post: #3
In Xcode, you can open the target's build settings, and add FREE_VERSION_OF_MY_APP next to Preprocessor Macros.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Xcode 4 OpenGL Game Template Question Macmenace 4 9,617 Mar 19, 2012 06:03 PM
Last Post: Macmenace
  XCode question kendric 3 4,502 Apr 30, 2009 02:55 PM
Last Post: OptimisticMonkey
  a small question (xcode button actions) imaumac 3 5,791 Oct 14, 2008 10:03 PM
Last Post: imaumac