Lazarus

Free Pascal => Beginners => Topic started by: CapelliC on June 26, 2020, 04:11:18 pm

Title: [solved] why the compiler flags a parameter as a duplicate property declaration?
Post by: CapelliC on June 26, 2020, 04:11:18 pm
Trying to compile ADODB.pas, that in turns references ADOInt.pas.
There, there at line 1312, I get an error I don't understand:


Code: Pascal  [Select][+][-]
  1.   Connection15Disp = dispinterface
  2.     ['{00000515-0000-0010-8000-00AA006D2EA4}']
  3.     property ConnectionString: WideString dispid 0;
  4.     property CommandTimeout: Integer dispid 2;
  5. ...
  6.     procedure Open(const ConnectionString: WideString; const UserID: WideString;
  7.       const Password: WideString; Options: Integer); dispid 10;
  8. ...
  9.  
  10.  
Code: [Select]
Errors: 23, Hints: 23
ADOInt.pas(1322,26) Error: Duplicate identifier "ConnectionString"
ADOInt.pas(1322,26) Hint: Identifier already defined in ADOInt.pas at line 1312
ADOInt.pas(1364,26) Error: Duplicate identifier "ConnectionString"
ADOInt.pas(1364,26) Hint: Identifier already defined in ADOInt.pas at line 1354
...(21 more...)

Seems it takes the parameter name for a property...
Sorry if sound like a stupid question, but what's wrong ?
Title: Re: why the compiler flags a parameter as a duplicate property declaration?
Post by: Bart on June 26, 2020, 04:33:33 pm
Probably you use {$mode objfpc}

Use
Code: Pascal  [Select][+][-]
  1. procedure Open(const AConnectionString: ...)
instead as a procedure declaration, or switch to {$mode delphi}, where this is allowed.

Bart
Title: Re: why the compiler flags a parameter as a duplicate property declaration?
Post by: CapelliC on June 26, 2020, 05:02:18 pm
Thanks, changed to {$mode delphi}, that worked.
TinyPortal © 2005-2018