-2

I am using quick report 6 in Delphi 10.2. When I add quickreport source path to library paths I am getting Incompatible type errors on qrpdffilt.pas.

Var
  P: ^ pos2table;
  Buff: array of ansichar;
  d: dword;
  RGBCol:TRGBColor;
  PColor: TColor;

  Pos2table is of type packed array

  Incompatible types issue comes for following lines

  P:=@Buff[d];
  RGBCol:=pcolor;

Any solution?

User421
  • 25
  • 8
  • We can't know what these types are. Still, I think you can worn this out for yourself. I'll help you do that. First of all read the documentation for that error message. Websearch will take you to it. The find the definition of the types involved. Then the error will become clear. – David Heffernan Aug 04 '18 at 04:46

1 Answers1

1

P := @Buff[d]; is assigning an ^AnsiChar pointer to a ^pos2table pointer, so of course the compiler will complain since they are pointers to different types, but only if you have type-checked pointers enabled, in which case you need to use a typecast to resolve it, eg:

type
  ppos2table = ^pos2table;
var
  P: ppos2table;
  Buff: array of ansichar;
  ...

P := ppos2table(@Buff[d]);

RGBCol:=pcolor; is trying to assign a TColor (an integer type, not a pointer type) to a TRGBColor (presumably a record type). There is no standard implicit conversion between them, so the compiler complains about this. You can use a pointer typecast to resolve this, too:

type
  PRGBColor = ^TRGBColor;
var
  ...
  RGBCol: TRGBColor;
  PColor: TColor;
  ...

RGBCol := PRGBColor(@pcolor)^;
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770