• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Utilizing OTHER_CFLAGS properly?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Utilizing OTHER_CFLAGS properly?


  • Subject: Re: Utilizing OTHER_CFLAGS properly?
  • From: Sam Krishna <email@hidden>
  • Date: Tue, 22 Dec 2009 12:26:35 -0600

Hi Fritz,

On Dec 22, 2009, at 10:01 AM, Fritz Anderson wrote:

I'm not Chris Espinosa; I don't even work for Apple. But maybe I know something...


Ahh... another Xcode god. Cool. :-)

On 22 Dec 2009, at 9:45 AM, Sam Krishna wrote:

I'm attempting to utilize OTHER_CFLAGS in the target's build settings (under User Defined settings) for different build configurations (Release vs. Debug vs. Demo, etc)

Why are you attempting to set OTHER_CFLAGS as a user-defined setting? It already has a UI setting; I wonder if attempting to set it user-defined doesn't get overridden by the setting provided for the purpose.


If the UI setting doesn't appear in the list, add a .c or .m file to the project. Xcode often won't include compiler settings until there's something in the target to compile.

I definitely have a set of code files to compile.


Right now, I've tried:

OTHER_CFLAGS=1

Leaving aside the issue of whether it should be user-defined, this doesn't make sense. First, the UI separates the name of the setting from the value by putting them in different columns. An "=" shouldn't enter into it. Second, even if the syntax were right, simply adding a "1" to a gcc command line will only get you an error.


OTHER_CFLAGS="-DTEST_FLAG=1"

There's already a UI setting for preprocessor defines. Search the build-setting list for "Preprocessor Macros" and "Preprocessor Macros not used in Precompiled Headers."



OK, I've removed OTHER_CFLAGS=1 from the Build Settings and here's what I'm trying now:


(1) I've set a User-Defined setting for TEST_FLAG and set its value to 1.

(2) I've put the following code in the app delegate method:

- (void)applicationDidFinishLaunching:(UIApplication *)application {

#if TEST_FLAG
  NSLog(@"Hey... we're here!");
#endif

...
}

(3) When I compile and run the application in the simulator, nothing happens.

and neither registers at compile time.

How do you mean "neither registers," and how do you know? In the Build Results window, set the build-progress display to show all the build steps, select a row for a C/ObjC compilation, copy, and paste into a text file. Examining the actual gcc command line will tell you something.


	— F


I did do that and there's no record of "TEST_FLAG" existing anywhere in the build output.


The only resolution I can see to this is to put the flag in the precompiled header. I'd *LIKE* to avoid that, but if that's what it comes down to, then I'm happy to do it. I can set up separate .pch files for each target.

-S _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Utilizing OTHER_CFLAGS properly?
      • From: Jean-Daniel Dupas <email@hidden>
    • Re: Utilizing OTHER_CFLAGS properly?
      • From: Sherm Pendley <email@hidden>
References: 
 >Utilizing OTHER_CFLAGS properly? (From: Sam Krishna <email@hidden>)
 >Re: Utilizing OTHER_CFLAGS properly? (From: Fritz Anderson <email@hidden>)

  • Prev by Date: #pragma
  • Next by Date: Re: Warning in error
  • Previous by thread: Re: Utilizing OTHER_CFLAGS properly?
  • Next by thread: Re: Utilizing OTHER_CFLAGS properly?
  • Index(es):
    • Date
    • Thread