DelphiOTP icon indicating copy to clipboard operation
DelphiOTP copied to clipboard

Compile issue on Delphi 12 with ifndefs

Open SkybuckFlying opened this issue 1 year ago • 1 comments

Problem with last line:

{###############################################################################
                      https://github.com/wendelb/DelphiOTP
###############################################################################}
unit GoogleOTP;

{$IFDEF FPC}
{$mode objfpc}{$H+}
{$ENDIF}

interface

uses
  {$IFNDEF FPC}System.{$ENDIF}SysUtils, {$IFNDEF FPC}System.{$ENDIF}Math, Base32U, {$IFNDEF FPC}System.{$ENDIF}DateUtils
  {$IFNDEF FPC}

[dcc32 Error] GoogleOTP.pas(13): E2029 Identifier expected but end of file found [dcc32 Error] GoogleOTP.pas(13): E2029 Identifier expected but end of file found [dcc32 Error] Base32U.pas(22): E2029 Identifier expected but end of file found [dcc32 Error] Base32U.pas(55): E2003 Undeclared identifier: 'UpperCase' [dcc32 Fatal Error] GoogleOTP.pas(13): F2063 Could not compile used unit 'Base32U.pas'

I will try to fix it myself but first I or copilot must understand what the problem is, it's kinda weird ! ;) =D

(Thanks btw for writing a small little app, saves me some time, I hope it's compatible with winotp and google authenticator ! ;) then I can compile/build this and hopefully this app will then work on windows 7, unlike all the other crap out there ! =D)

SkybuckFlying avatar Mar 12 '24 15:03 SkybuckFlying

Fixed it for you:

uses
(*
  {$IFNDEF FPC}System.{$ENDIF}SysUtils, {$IFNDEF FPC}System.{$ENDIF}Math, Base32U, {$IFNDEF FPC}System.{$ENDIF}DateUtils
  {$IFNDEF FPC}
	, IdGlobal, IdHMACSHA1
  {$ELSE}
	, HMAC
  {$IFEND};
*)

  Base32U,

  {$IFDEF FPC}
  SysUtils,
  Math,
  DateUtils
  {$ELSE}
  System.SysUtils,
  System.Math,
  System.DateUtils,
  {$IFEND}

  {$IFNDEF FPC}
  IdGlobal,
  IdHMACSHA1
  {$ELSE}
  , HMAC
  {$IFEND};

SkybuckFlying avatar Mar 12 '24 15:03 SkybuckFlying