How to add two compiler flags in Xcode - iphone

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?

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

In Xcode, clic on your project file to see the pane with your target(s) and then :
Select the "Build Phases" tab
Unfold "Compile sources"
Search for your specific file
Set your compiler flags on this particular file by double-clik on this column.
Hope this helps

Select your project in the project navigator in the left-hand panel, select your target, then select Build Phases. Expand Compile Sources and double-click the file you want to set the compiler flag for. Repeat for each target you want the changes to apply to.

Select blue project file
Select "Build phases".
Disclose "Compile Sources".
Double click on file that you want to add flags.
Then set flags separated by space.

Related

Could not disable ARC in xcode4.2

I am working on ARC environment and I successfully disable Facebook API through -fno-objc-arc. I also want to disable this for my own class, and I did same method as with Facebook API classes, but I couldn't disable ARC. If anyone know please help me on that.
To get rid of this error you need to disable ARC, to disable ARC from your project do the following steps.
Select your project file.
You should be in the “Build settings” tab. Select the “levels” option (default is “Combined”)
There’s a search field to the right of “Combined”. Enter “Automatic”
Second group should be “Apple LLVM Compiler 3.0 – Language”. Second line under that controls ARC.
Click that line, then in the middle column (where it says “yes”), click and choose “no”.
Now the error should gone.
Just to make sure you are doing this in the right place:
In the project navigator, click on the top item, the project name
In the pane that appears with project and targets, select the correct target where the non-arc file is included
Go to Build Phases, open Compile Sources
Select the file that needs to be non-arc, double click it, and enter -fno-objc-arc
Build.
So double check you did this, especially selecting the right target.

How do I keep files not associated with the project in XCode 4 without generating a warning

I recently upgraded to XCode 4 and adjusting. I have a folder called "Unused" in which I keep some .h and .m files. They are basically code which are no longer associated with the project and I keep them because they serve as a reference. The compiler doesn't look what it sees in there so I change the .h and .m files to .h.txt and .m.txt. However, I get this warning:
warning: no rule to process file '$(PROJECT_DIR)/Classes/AddViewController.m.txt' of type text for architecture i386
Does anyone have any solution for this?
Thanks.
Select the target in XCode, then in the Build Phases tab, under Compile Sources, remove the unused files that you don't want. XCode will only compile the files listed.
If you don't want the files to link, you can select the relevant file on the left side project navigator, then go to your right side bar and select the File inspector (left most icon on top right bar), then scroll down to "Target Membership" and unclick the checkbox so the file is not associated with any of your targets.

Specifying multiple Eclipse's Make Targets with control of order/dependence?

Is there any way to specify multiple Make Targets to be built by the build process, and if so, then it is possible to control the order or define dependence of the Make Targets in a managed C++ project?
If you want to do this in eclipse and at the command line, I'd edit the makefile to add a targets depending on the items. Make will figure out the order if needed.
If it's ok to have this work just in the Eclipse project then add a custom make target
In the "Make Target" view, click "Create a Make Target", uncheck "Same as Target Name".
List your multiple dependencies all in the "make target" edit box.

Error : Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'UserDefinedLocalization-Info.plist'

When I run the Application then warning display below,
Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'UserDefinedLocalization-Info.plist'.
I had this issue after I rearranged the underlying file structure of my project. Xcode4 has moved things around though and most online help to this problem is Xcode 3 specific, so this is how you solve this in Xcode 4:
Click the project icon in the Project Navigator (the blue root icon)
In your main pane menu you should be able to choose between your project or targets, select the target
Select "Build Phases" in the top menu
Open the "Copy bundle resources" item
Remove your plist file from there (your plist file should not be copied as a part of the bundle)
In xcode, right click the UserDefinedLocalization-Info.plist file, select Get Info. Go to the Targets tab and remove the checkmark in front of your target.
The info.plist is a special file and must be treated in a special way. It's not allowed to add it to the app in the normal way.

in eclipse cdt, how to build target other than the first one

I am quite newbie in using eclipse cdt. I have a makefile project, and have more than two targets in my Makefile. Say the Makefile is as follows,
all:
...
t1:
...
t2:
...
it's easy to make CDT build target 'all'. However, how can I build targets other than the first one, like t1 and t2? Thanks.
In eclipse, go to:
Window > Show View > Make Target
In the view that opens up, right click your project, click on "New".
Give your target a name, say "T1". Uncheck the "same as the target name" and put the "Make Target" value to t1.
Same for t2.
The next time you want to build your targets, look at the Make Target view that you opened, and double click the target you want.