Saturday, 23 January 2010

C++ Errors

This isn't a proper blog entry but I felt I had to say something about this small (GINORMOUS) problem I encountered.

I'll set the scene for you, it was a quiet Saturday morning, I was leisurely sipping coffee as I went about re-factoring some of the code I had written the night before (which now looked terrible compared to what I remembered writing). I had made a few changes, checked over the file I was working on to ensure there weren't any glaring errors such as missing semicolons (Hey, we all do it okay). I hit build, and to my sheer horror, 161 errors leapt at me from the output window.

Now when this happens it is usually something easy to spot like a missing curly brace, and you can quickly fix the problem, but maybe because I had only drunk half my coffee, and it was now tepid and undrinkable, I could not for the life of me find the problem. I poured over the source code, looking in every file that was referenced by the one I had changed. Had I accidentally hit a key while I was changing pages? I couldn't find anything.

Thirty minutes later, with half the hair I had when I started now missing and tears welling in my eyes, I was ready to give up and become an art student (sorry art students). Then, just as all hope seemed lost, I caught something out of the corner of my eye, could it be? There staring me in the face was something that almost made me tear out any remaining hair I had. A class called Projectile was being declared, however it had somehow acquired an 's' on the end, so it was now 'Projectiles'. This typo had caused Visual Studio to throw up 161 errors!

I deleted the 's', hit compile, and Wooosh, everything was working again and the world was lovely...

That's life I guess, and another lesson learned that proof reading, perhaps more so in code than anything else, is intensely important. Now I am off to buy a hat to cover up the bald.

4 comments:

overworkedchimp said...

Its safe to say this will happen for the rest of your programming life... lol

tomhhh said...

lol, I look forward to it ;)

Anonymous said...

Maybe if you get a usb coffee warming coaster everything will work out and you'll never have tepid coffee again?!
:)

tomhhh said...

lol genius! I shall invest in such a device post haste :)