Ideas, and an Eclipse trick

When I started this blog I knew my updates would be infrequent, but I didn't expect to go ten months without one. I've had many ideas for posts, and other things, in that time. I have tried different methods to help me remember these ideas, from sending myself emails to maintaining a Google Documents list to carrying around a little spiral-bound notebook. So far, none of these methods has really done anything for me.

A couple weeks ago I read a blog post by someone else who had similar problems with some of the methods I describe above, in particular the notebook method. (I wish I could find the link to this blog. If I come across it again, I'll add it.) He finally settled on using small blank cards to capture his ideas and thoughts. He writes a single thought on a blank card when it pops in his head; at the end of the day, he takes the used cards and stores them in a box that he consults regularly. I've decided to implement this by cutting some blank 3x5 index cards in half and carrying the pieces in my wallet. When I have an idea, I write it down and put the card back in my wallet. I'm still trying to build a habit out of this, and I'm still working on the storage and regular consultation parts, but so far its working better than my notebook did. In fact, the Eclipse trick I'm going to mention is one of the first things I wrote down using this method.

I've been using Eclipse at work for my C and C++ development for the past four months or so. The vast majority of my development is in C, though, so for our core application code I've been creating C projects in the CDT. The other day, however, I wanted to work on a small amount of C++ code that is part of an external tool that gets rolled up in our application. Since my project only has the "C" nature Eclipse couldn't resolve any of the C++ headers or keywords, making it fairly useless for editing this tool code. Unfortunately, once you create a CDT project and choose either "C project" or "C++ project", there is no way to change this decision; in particular, there is no way through Eclipse to add the C++ nature to a C project. I discovered after examining the Eclipse project file that there is a way.

The project XML has a section named <natures>, which lists all of the natures associated with the project. All you have to do to add C++ to a C project is add the line


to the <natures> section of the C project. Reopen the project, and you should have C++ listed as a language in the symbols and paths screens. This saved me from having to re-generate the whole project, or work outside Eclipse, just to handle that little bit of C++ code.