In trying to get Log4D to compile in XE4, I was seeing
[dcc32 Error] Log4D.pas(2139): E2003 Undeclared identifier: 'ShortDateFormat'
on this line:
SetOption(DateFormatOpt, ShortDateFormat);
A bit of googling led me to the solution of changing ShortDateFormat
to FormatSettings.ShortDateFormat
, which led to the following compiling code on XE4:
SetOption(DateFormatOpt, FormatSettings.ShortDateFormat);
However, I don't really understand why that fixes things why it's needed to specify FormatSettings
since I already included SysUtils
in my uses statement, and secondly, I'm not sure how to rewrite this line to continue to be backward compatible with the versions of Delphi this open source project already supports.
I suppose I could add an IFDEF around that parameter or line of code for whatever version of Delphi introduced FormatSettings
- but I'm not even sure what version of Delphi that was, let alone whether that's a good or bad way to solve this problem.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…