[Note, XCode 3.2 did away with the Errors and Warnings Smart Group. 🙁 Its functionality is now moved to the Build Results Window. I’ll probably write an update to this whole setup soon.]
After a few months of working with XCode, I’m starting to fine tune my set up to make it easier to code, compile and debug. A couple of tips for today on dealing with compile errors. Say you compile and you have an error in your code. Don’t laugh. It could happen. With the default setup, you’ll get something like this:
At first those little bubbles seem kind of neat, but after a while, you will hate them. They persist after you fix an error, til the next build, unless you double click on them, and it’s like driving with a bug on the windshield. So first thing we do is turn them off.
Now, you’ll still get the red x, which you can click on to see the bubble if you want. But we’ll soon see something better.
The next problem is, what if the error(s) isn’t in the file that is currently shown in the editor? You see down in the lower right corner that your build failed with one error, but where is it? Well, you can click that message, which opens the Builds Results window.
You see this shows and describes the error in the top part of the window, and opens the file in the file itself in the bottom. So no need for the bubbles anymore. A few things I don’t like about this though. Most of all, I already have an editor window open. I don’t like having this other floating window with another editor. The other thing is that the top window shows not just errors and warnings, but the whole build process, so if you have a few errors, you kind of have to pick them out in a long list of other messages. It’s not too hard, but I’ve found yet a better way. The Errors and Warnings Smart Group. Set this to open up automatically any time you have errors or warnings:
Now, if you have errors, they will appear in that group, that group will be selected, and in the details window at the top of your editor, you will get a list of all errors and warnings, and nothing else. Click on any error and it will open up in your main editor window. Furthermore, you can look at the group itself to see which files have errors. In this case it’s just one error in the App Delegate file, but if there were problems in multiple files, they would all be listed in the smart group, and you can click on a file in that group to just see the errors in that particular file.
The final thing I do is change the position of this smart group. By default it is placed way down under Targets and Executables. In this simple example, which only has a single class, it’s no problem, but when your classes group and resources group contain a whole bunch of items, and those are expanded, the Errors and Warnings group will be way down out of sight. But when it’s selected, the whole Groups and Files panel will scroll down to show it, and when you’re done you have to scroll up again to get back to your files. A minor thing, but what I do is just drag the Errors and Warnings group up to the top.
Following the settings image above, it will automatically if you have no errors or warnings, so it’s never in the way, but opens up and is selected and above everything else when you DO have problems. Right where you want it.
So some minor tweaks, but I find it streamlines development quite a bit. You have errors, they show up in a list at the top details panel right away, with the list of files in the top left. Click on an error and the file is displayed, right at the particular error. No nasty bubbles in your way.
that stuff was driving me nuts
Have you seen the pragmatic programmer XCode videos? A friend let me watch the first one and it hipped me to lots of cool time savers and IDE shortcuts…..
Kent, yeah, those videos are well worth the $10.
fwiw, I just noticed a bunch of XCode settings under System Preferences.
That bloody red bubble always chapped my ass. Thanks to you, it won’t any more 🙂
Another simple but handy setting are some of the console options. I’m too lazy to go to my mac to find exactly where they are in the preferences, but they’ll clear the console and make it pop up whenever you do a build.
dude, that’s awesome! thank you!!
You have no idea how much this has made my building a more pleasant experience. You rock!
i’m compiling with a makefile … i get the errors … but double-clicking on them does not bring up the offending source code file …
any ideas …