Pages

Monday, November 17, 2008

Delphi 2009 - How to treat warnings as errors

A long overdue addition to Delphi is the ability to treat compiler warnings as errors. I could have done with this some years ago and have really missed it since moving from C# back to Delphi a few months ago.

If you've had some trouble finding where to enable this option, I suggest you have read at this classic Daily WTF article and then have another go at looking for it.

Turns out that under the 'Hints and Warnings' section of the project options there is an option called 'Output Warnings'. Next to it is a drop down list with the default value of 'True'. Now most sane people would expect there to be only one more option in that drop down list. Turns it there is actually another two! Dropping down the list reveals all 3 options: 'True','False' and 'As Errors'

Hmmm. No wonder I couldn't find it.

I posted a question on Stack Overflow in case others are looking for it.