I want to set GCC_PREPROCESSOR_DEFINITIONS for each of my four build configurations (Debug, Release, Ad Hoc, and Distribution.) I'd like to have a different setting for each.
The screen I'm looking at is the Target Info window's "Build" tab. When I set the Configuration pop-up to "Debug" I can see my GCC_PREPROCESSOR_DEFINITIONS setting there. When I switch to "Release," or any of the other configurations, it's no longer visible. Yet when I try to add it to those configurations, it says GCC_PREPROCESSOR_DEFINITIONS already exists, and that I can't add it again.
As I said, I want to have a different setting for my various builds. How can I accomplish this?
Thanks very much.
Make sure there isn't a setting called "Preprocessor Macros". This is the same as GCC_PREPROCESSOR_DEFINITIONS.
OTHER_CFLAGS if I understood the question right. And pass your defines like -DDEBUG or something.
And yes, if you need to assign a value to a macro, you could do something like this - '-DSOME_MESSAGE=#"Hello, World!"'.
Note ' symbols around - they are required. SOME_MESSAGE macro will be defined with #"Hello, World!" value.
Related
I work with large project having different modules, subprojects. When I am working with one module I need to create set of debugpoints/breakpoints to debug that module.
When I have to work with other one, to debug it, I have to create another set of breakpoints and disable the ones created to debug the earlier module.
When I want to debug (dont conclude that I write buggy code...its just that....it just happens :p) third module, I have to create thrid set of debug points, disable the earlier two sets corresponding to earlier two modules.
Same with debugging fourth module.
Same with debugging fifth module.
Now I want to come back to debugging first module. I have breakpoints related to all modules in my breakpoint window. Say 5 breakpoints corresponding to each module. Total 5*5 = 25. Now I have to go through reading each breakpoint checking which belongs to the first one, enabling them and disabling others.
Am I missing something. Is some simpler/standard way to ease this already there in eclipse.
I feel there should be say "Save set of breakpoints" option which note all the breakpoints currently in the breakpoint window as belonging to same set and will then ask us to give name to that set, say in my case "Module 1".
Then another option "Create new breakpoint set", which will clear up breakpoint window without deleting already created named breakpoint sets
Then, ofcourse the option to "Load breakpoint set" which will simply show up the set we saved as, say in dropdownlist. We select the named breakpoint set and it will end up loading those set of breakpoints.
Q. Am I overthinking? Is similar stuff already there? Also willing to know if similar stuff is there in Visual Studio too
Use 'Breakpoint Working Sets' for this.
In the Breakpoints view (in the Debug perspective) click the small triangle at the top right of the view and select the 'Working Sets...' menu item. This will let you manage the breakpoint working sets.
More details in the Eclipse help
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.
Ok, i think i've seen it all now.
For about 24 hours i've been trying to debug my app, trying to find where all the weird crashes are coming from all of a sudden. I've been debugging via Simulator/Debug mode. As usual, when i hit a breakpoint, i could see the value of variables (most of the time). Then suddenly i was unable to view variables no matter what i did (btw, im talking about mouse-hovering as for some stupid reason my xcode disabled all the debugging tools from the debug menu).
Long story short, out of sheer loss of things to do, i decide to debug with Release mode. Now I can hit breakpoints and see the contents of my variables. And whats even more confusing is that now xcode gives me a much more comprehensive view of the variables that im 'watching' (hovering over).
I know Apple likes to do things different. But what the heck!? Can somebody please slap me and then tell me what im not understanding here?
First, the configurations "Debug" and "Release" are just names, you could also name them "Jon" and "Carla" if you want. They are just names for a configuration sets that you can modify and you can tweak them so that for example the "Debug" configuration is not suitable for debugging any more. So if you (accidentially) disabled generating debug symbols in your "Debug" configuration you would get exactly what you described.
Go to "Project" -> "Edit active target". Select the "Build" tab and select the "Debug" configuration in the drop down box on the upper left. Select "Show all settings" in the drop down box below and type "debug" in the search bar right next to these two drop down boxes.
There should be a setting "Generate Debug Symbols", make sure its check box is set. "Level of Debug Symbols" should be set to "All Symbols". Also, the "Debug Information Format" should be set to "DWARF with dSYM file".
After changing the settings, clean your project ("Build" -> "Clean") and build again.
Hope that helps.
How do I reset build settings to default in Xcode?
To reset a single project setting so that it's no longer bold, select the option in the project settings and hit the delete key.
Xcode reset build settings to default
When a target's setting is changed Xcode bold it. Also you can find all changed settings in Customized tab. Moreover you can check who exactly influences on the value using Levels tab.
To reset(unbold) a value just select and press delete key
Sometimes, especially with multi-line items, hitting delete or cmd-delete does not work. For those items I just resort to setting the first line to $(inherited). This means the item is still bold, but it will otherwise have the correct value.
Hitting Delete didn't work for me, but that's because I was looking at the settings from the point of view of the target, when the setting was set for the project. Switching to the project view worked -- hitting Delete removed my setting and reverted back to the default (non-bold) value.
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!