Recent

Author Topic: [Solved] Can't compile Lazpaint in Lazarus x64  (Read 5022 times)

lainz

  • Guest
[Solved] Can't compile Lazpaint in Lazarus x64
« on: April 25, 2012, 08:17:49 pm »
Lazarus 0.9.30.4 r35940 FPC 2.6.0 x86_64-win64-win32/win64

LazPaint latest svn

Hint: Start of reading config file C:\lazarus\fpc\2.6.0\bin\x86_64-win64\fpc.cfg
Hint: End of reading config file C:\lazarus\fpc\2.6.0\bin\x86_64-win64\fpc.cfg
Free Pascal Compiler version 2.6.0 [2012/03/14] for x86_64
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Win64 for x64
.
.
.
uchoosecolor.pas(220,111) Error: Can't determine which overloaded function to call
bgradefaultbitmap.pas(1100,29) Hint: Found declaration: TBGRADefaultBitmap.GetPixel(Single,Single,TResampleFilter="0"):<record type>;
bgradefaultbitmap.pas(1087,29) Hint: Found declaration: TBGRADefaultBitmap.GetPixel(LongInt,LongInt):<record type>;
uchoosecolor.pas(362) Fatal: There were 1 errors compiling module, stopping
« Last Edit: April 29, 2012, 05:36:20 pm by lainz »

circular

  • Hero Member
  • *****
  • Posts: 3047
    • Personal webpage
Re: Can't compile Lazpaint in Lazarus x64
« Reply #1 on: April 26, 2012, 06:24:45 pm »
This is a compiler issue, I suppose. Please try with a another version of the compiler.
Conscience is the debugger of the mind

lainz

  • Guest
Re: Can't compile Lazpaint in Lazarus x64
« Reply #2 on: April 26, 2012, 08:22:30 pm »
It's the latest oficial lazarus download for windows 64

edit: it's solved changing this line in uchoosecolor.pas

pix := Colorcircle.bmpMaxlight.GetPixel(x-ColorCircle.Bounds.Left,y-ColorCircle.Bounds.top);

to

pix := Colorcircle.bmpMaxlight.GetPixel(LongInt(x-ColorCircle.Bounds.Left),LongInt(y-ColorCircle.Bounds.top));

if this works for you please update the source ;)

btw there is an unknown exception on starting lazpaint

then the fileutil.inc at line 1459 is highlighted

fs := TFileStream.Create(UTF8ToSys(Filename), fmOpenRead or fmShareDenyWrite);

this is a lazarus or lazpaint problem?
« Last Edit: April 26, 2012, 08:56:14 pm by lainz »

circular

  • Hero Member
  • *****
  • Posts: 3047
    • Personal webpage
Re: Can't compile Lazpaint in Lazarus x64
« Reply #3 on: April 27, 2012, 10:20:35 pm »
This is mysterious. Really, I think both problems are related to FPC.
Conscience is the debugger of the mind

lainz

  • Guest
Re: Can't compile Lazpaint in Lazarus x64
« Reply #4 on: April 28, 2012, 09:09:10 pm »
Must be, the problem is that the compiler "don't understand" the result of a math operation in 64 bits with type integer and type longint.

pix := Colorcircle.bmpMaxlight.GetPixel(x-ColorCircle.Bounds.Left,y-ColorCircle.Bounds.top);

the function expect longint and the used values are integer.

maybe there is some switch to handle this?

pd: i'm talking with ignorance of

circular

  • Hero Member
  • *****
  • Posts: 3047
    • Personal webpage
Re: Can't compile Lazpaint in Lazarus x64
« Reply #5 on: April 29, 2012, 02:31:20 pm »
Oh type integer does not mean the same in 64 bits ?

I've checked it :
Quote
FPC currently uses 32 bits (4 bytes) for integers, whether the machine is a 32-bit or 64-bit machine. This will cause code expecting an integer and a pointer to be the same size to fail as a 64-bit machine uses 64-bit pointers. To allow you to write portable code, the FPC system unit introduces the types PtrInt and PtrUInt which are signed and unsigned integer data types with the same size as a pointer.
http://wiki.freepascal.org/Integer/fr

So integer always = longint.
Conscience is the debugger of the mind

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7589
Re: Can't compile Lazpaint in Lazarus x64
« Reply #6 on: April 29, 2012, 04:45:54 pm »
So integer always = longint.

In Delphi like (objfpc and delphi) modes.

In TP and FPC (default) mode, they are 16-bit.

lainz

  • Guest
Re: Can't compile Lazpaint in Lazarus x64
« Reply #7 on: April 29, 2012, 05:18:57 pm »
Now I understand you is a problem of the compiler if both types are the same because LazPaint is using objfpc mode ¬¬