Difference between revisions of "FPC message: Wrong number of parameters specified"
From Lazarus wiki
Jump to navigationJump to search (syntaxhighlight) |
(+Category:Compiler Messages; replace translation template) |
||
Line 1: | Line 1: | ||
− | {{ | + | {{Translate}} |
== Missing parameter or too many parameters == | == Missing parameter or too many parameters == | ||
Line 14: | Line 14: | ||
Delphi users often confuse this, because Delphi allows it and adds the @ internally. If you prefer the Delphi syntax you can use {$mode Delphi} instead of {$mode ObjFPC}. | Delphi users often confuse this, because Delphi allows it and adds the @ internally. If you prefer the Delphi syntax you can use {$mode Delphi} instead of {$mode ObjFPC}. | ||
+ | |||
+ | [[Category:Compiler Messages]] |
Revision as of 19:34, 12 January 2015
Missing parameter or too many parameters
You confused the function and forgot a parameter or added a parameter too much.
Missing @
For example:
Button1.Click := Button1Click;
In mode objfpc you must add the @ to tell the compiler, that you want the pointer to the function, not the result of the function:
Button1.Click := @Button1Click;
Delphi users often confuse this, because Delphi allows it and adds the @ internally. If you prefer the Delphi syntax you can use {$mode Delphi} instead of {$mode ObjFPC}.