I have a few questions about Xcode and interaction with GCC 4.2.1:
It doesn't seem as if Xcode Target Properties inspector exposes all possible GCC options. Is this correct?
More specifically, I'm interested in setting the "mfpu" option, as mentioned in the arm_neon.h intrinsics header. Is this possible or supported? Or perhaps set as a side-effect of some other Xcode setting?
If anyone has tried this or can post some resources, it would help a lot.
There are not checkboxes or menus available each option presented by the compiler, however you can enter any flags you'd like passed to the compiler in the "Other C Flags" field of the Target inspector.
Just set "Other C Flags" to "-mfloat-abi=softfp -mfpu=neon" and you'll be set.
Related
I have two targets set up for my app (a lite version and a pro version) and I want to integrate some subtle differences in the code for each of them (e.g. the pro version will not show any iAd banners).
I have been looking around and I see the easiest way to do this is through the use of preprocessor macros. The issue I'm facing is how to set them up in Xcode 4. I want to set up a macro called 'PRO_VERSION' in one target & 'LITE_VERSION' in the other.
Below is an example of how I intend to use them:
#ifdef PRO_VERSION
// Hide ad banners
#else
// Show ad banners
#endif
The build setting you need to change is called 'Preprocessor Macros' and it can be found in the 'Build Settings' tab of the Project Settings pane (use the search box to find it). Select each target in turn in the left-hand side of the Project Settings pane then modify the Preprocessor Macros setting.
The setting is specified as a space-separated list of preprocessor macros in the form 'foo' or 'foo=bar'.
I'm not on my mac at the moment, so I can't give full step-by-step directions, but I believe this should be accurate, if not as detailed as I would otherwise be. Create a new build target. Go to the configuration screen for this new target. There should be a tab along the lines of compilation options. In this tab there should be a row for other compiler flags. In there, put -DPRO_VERSION.
in Xcode 4, I created a sub project in my iOS project and made it a "Cocoa Static Library". In the Project/Target Build Settings, there is no option for "Other C Flags". Actually, there are no compiler options at all. Can anyone explain why this is?
Is the Basic option selected on the upper left instead of all?
I am recently trying to connect my cocos2d game with open feint, but I can't accomplish it as there seem to be some settings missing in my build settings of any project that I create.
For example, I have to check "Call c++ Default ctors/Dtors in objective c", but there isn't such an option in my build settings. What's wrong with that?
Here is a picture:
http://img413.imageshack.us/img413/3425/bildschirmfoto20101023u.png
My project is the one on the left, I downloaded the right one. I need to my build settings to like like the ones on the right. Is that somehow possible?
In the image, you have the build settings windows set to show "settings defined at this level". Since you haven't yet changed the other linker flags setting, naturally it doesn't show up. If you show all settings, you should see it.
Is there any reason why you shouldn't use the "-std=c99" flag for compiling Objective-C programs on Mac? The one feature in C99 that I really like is the ability to declare variables anywhere in code, rather than just at the top of methods, but does this flag causes any problems or create incompatibilities for iPhone or Cocoa apps?
Compiled C99 binary code is binary-compatible with older C variants. The only downside is if you have to share code with other projects that aren't C99 (or GNU99).
The same applies to Objective-C
I've tried it myself on a small iPhone app, and it works. I've seen no problems with it.
A good way to do this if your project settings aren't letting you do it is to add a User-Defined setting. To do so:
Open your "Project -> Edit Project Settings" menu item.
at the bottom left, select "Add User-Defined Setting" from the dropdown menu
Replace the left side text "New Setting" with GCC_C_LANGUAGE_STANDARD
add the text "c99" to the right side of the line
clean your target & rebuild!
In my code, I want to conditionally perform a few operations with:
#ifdef DEBUG
NSLog(#"I'm in debug mode");
#endif
I've configured Project->Edit Project Settings->Build tab so that 'DEBUG' is listed as a User-Defined setting with a value of 1. Debug is selected in the Configuration dropdown. This still doesn't turn on the directive for the Debug build although I thought that's what it would do.
What else do I need to do during the build stage to allow for this?
You need to set a compiler flag for that.
To do it, Get Info on the target, make sure you have selected the Debug configuration (and not All Configurations), and look for Other C Flags and Other C++ Flags (in Xcode 3.1 these are under GCC 4.2 - Language).
Then add the following as a value: -DDEBUG for both.
This will define the DEBUG for the precompiler to pick it up.
project -> settings -> c/c++ (or code generation?) look for a text box labeled Preprocessor Definitions and just add DEBUG to the end of the comment separated list.
The above solutions seem like SDK 3.0 solutions, I'm still living in a 2.2.1 world with XCode 3.1.
This link did the trick for me, complete with pictures!