Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add two compiler flags in Xcode

I would like to add two compiler flags, one for ARC (-fno-objc-arc) and one for warning (-w). Anybody know how to add two compiler flags in the Xcode build phase for a particular file?

like image 408
AAV Avatar asked Sep 05 '12 23:09

AAV


People also ask

How do I add compiler flags in Xcode?

You can then add swift compiler flags so that we can check the current configuration through code. To do that, goto Project (not target)→Build settings → Swift Compiler → Custom flags → Other swift flags section and edit the different configuration flags. Add the flags using the syntax “ -D <flag_name>”.

What is Xcodebuild?

The main goal of Xcode Build System is to orchestrate execution of various tasks that will eventually produce an executable program. Xcode runs a number of tools and passes dozens of arguments between them, handles their order of execution, parallelism and much much more.

Where is build settings in Xcode?

Choose the project in the Project Navigator on the left. Select the Configurations target from the Targets section and click the Build Settings tab at the top. The Build Settings tab shows the build settings for the Configurations target. It's possible to expand this list with build settings that you define.

What are active compilation conditions?

The new setting is called "Active Compilation Conditions", which provides top-level support for the Swift equivalent of preprocessor flags. You use it in exactly the same way as you would "Other Swift Flags", except there's no need to prepend the value with a "-D" (so it's just a little cleaner).


2 Answers

Add the compiler flags under your Project -> Target -> Build Phases, just separate the flags by a space.

Imgur

like image 192
danielbeard Avatar answered Sep 30 '22 11:09

danielbeard


In Xcode, clic on your project file to see the pane with your target(s) and then :

  1. Select the "Build Phases" tab
  2. Unfold "Compile sources"
  3. Search for your specific file
  4. Set your compiler flags on this particular file by double-clik on this column.

Hope this helps

like image 43
iGranDav Avatar answered Sep 30 '22 11:09

iGranDav