Recent

Author Topic: [SOLVED] Can't compile LazPaint  (Read 2815 times)

lainz

  • Hero Member
  • *****
  • Posts: 4473
    • https://lainz.github.io/
[SOLVED] Can't compile LazPaint
« on: July 25, 2016, 07:54:16 pm »
Hi, I've downloaded Lazarus from shttp://www.getlazarus.org/
FPC 3.1.1 and Lazarus SVN 51308

The messages are:

Compilar proyecto, Modo: Release, Objetivo: release\lazpaint.exe: Código de salida 1, Errores: 28
uadjustcurves.pas(159,50) Error: Wrong number of parameters specified for call to "Round"
types.pp(582,18) Error: Found declaration: Round:<record type>;
uadjustcurves.pas(159,59) Error: Wrong number of parameters specified for call to "Round"
types.pp(582,18) Error: Found declaration: Round:<record type>;
uadjustcurves.pas(159,81) Error: Wrong number of parameters specified for call to "Round"
types.pp(582,18) Error: Found declaration: Round:<record type>;
uadjustcurves.pas(160,42) Error: Wrong number of parameters specified for call to "Round"
types.pp(582,18) Error: Found declaration: Round:<record type>;
uadjustcurves.pas(160,59) Error: Wrong number of parameters specified for call to "Round"
types.pp(582,18) Error: Found declaration: Round:<record type>;
uadjustcurves.pas(160,68) Error: Wrong number of parameters specified for call to "Round"
types.pp(582,18) Error: Found declaration: Round:<record type>;
uadjustcurves.pas(522,31) Error: Wrong number of parameters specified for call to "Round"
types.pp(582,18) Error: Found declaration: Round:<record type>;
uadjustcurves.pas(522,40) Error: Wrong number of parameters specified for call to "Round"
types.pp(582,18) Error: Found declaration: Round:<record type>;
uadjustcurves.pas(522,59) Error: Wrong number of parameters specified for call to "Round"
types.pp(582,18) Error: Found declaration: Round:<record type>;
uadjustcurves.pas(522,68) Error: Wrong number of parameters specified for call to "Round"
types.pp(582,18) Error: Found declaration: Round:<record type>;
uadjustcurves.pas(529,31) Error: Wrong number of parameters specified for call to "Round"
types.pp(582,18) Error: Found declaration: Round:<record type>;
uadjustcurves.pas(529,40) Error: Wrong number of parameters specified for call to "Round"
types.pp(582,18) Error: Found declaration: Round:<record type>;
uadjustcurves.pas(529,49) Error: Wrong number of parameters specified for call to "Round"
types.pp(582,18) Error: Found declaration: Round:<record type>;
uadjustcurves.pas(529,68) Error: Wrong number of parameters specified for call to "Round"
types.pp(582,18) Error: Found declaration: Round:<record type>;

Seems that now Round is part of TPointF in unit Types:

Code: Pascal  [Select][+][-]
  1. function TPointF.Round: TPoint;
  2. begin
  3.   result.x:=System.round(x);
  4.   result.y:=System.round(y);
  5. end;  
  6.  

And enters in conflict with the round function. Is a problem of FPC / Lazarus or Lazpaint?
« Last Edit: July 29, 2016, 04:55:13 pm by lainz »

lainz

  • Hero Member
  • *****
  • Posts: 4473
    • https://lainz.github.io/
Re: Can't compile LazPaint
« Reply #1 on: July 25, 2016, 09:24:31 pm »
@Circular, I've fixed it on Git, now instead of using Round is using System.Round in uadjustcurves.pas

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: Can't compile LazPaint
« Reply #2 on: July 25, 2016, 09:27:42 pm »
Quote
Is a problem of FPC / Lazarus or Lazpaint?
Neither. It is an sort of incompatibility that arises from the changes in the predefined types.

In some way, the problem comes from the fact that the with instruction is ambiguous in the sense that it is not possible to specify if the identifier that are written within it are to use the with instruction or not.

For example this problem does not happen with VB.NET, because you would write something like:
Code: [Select]
With pt
  DoSomething(.X, .Y)
End With
There is a dot in front of the identifier that are supposed to make use of the variable pt.

As with Pascal it is not possible to make that difference, it would be better to avoid using the same names. So calling the function Round to return the TPoint from a TPointF is likely to gives such compilation errors.

A way of fixing this problem could be to make the compiler smarter: it sees the identifier "round" and it could look at all the possible identifiers, and not stop at the first possible interpretation. Indeed calling "round" with parameters is not possible with the function defined in TPointF, so it could go to the next interpretation of it and use "System.round" instead.

Quote
@Circular, I've fixed it on Git, now instead of using Round is using System.Round in uadjustcurves.pas
Thanks. That's indeed what we can do at the level of LazPaint to adapt the program.
« Last Edit: July 25, 2016, 09:29:36 pm by circular »
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4473
    • https://lainz.github.io/
Re: Can't compile LazPaint
« Reply #3 on: July 25, 2016, 09:35:07 pm »
Yes I have a problem related recently with fpGUI where is defined gdVertical the same as in bgra units, so I need to prefix the unit name to avoid confusion.

Is not a with but the compiler must do it automatically too as you suggest. To use the correct one automatically.
« Last Edit: July 25, 2016, 10:49:24 pm by lainz »

 

TinyPortal © 2005-2018