0

When I create a TZCompressionStream object with:

var
  cs: TZCompressionStream; 
  dest: TStream;
  level: TZCompressionLevel;
...
  cs := TZCompressionStream.Create(level, dest);

I get this compiler error:

E2250 There is no overloaded version of 'Create' that can be called with these arguments

But my code is according to the constructor declaration:

Create(compressionLevel: TZCompressionLevel; dest: TStream); overload; 

When I used XE, everything was OK. But now with XE5 there is this error. Why?

Update:

  • Working code: cs := TZCompressionStream.Create(dest);
  • Faliing code: cs := TZCompressionStream.Create(clMax, dest);

I also tried to change the order of the arguments, which was unsuccessful.

NGLN
  • 43,011
  • 8
  • 105
  • 200

1 Answers1

4

I'm assuming that your code is as stated in your edit:

cs:=TZCompressionStream.Create(clMax, dest);

The obvious explanation is that clMax is not what you think it is. There is probably another unit that defines clMax and that unit appears after ZLib in your list of uses. Solve the problem by either:

  • fully qualifying the enumerated value: ZLib.clMax, or
  • change the order of the uses so that ZLib appears after the unit which defines the other clMax.
NGLN
  • 43,011
  • 8
  • 105
  • 200
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • 1
    It's unclear how the OP is passing `level` parameter. `level := clMax`? or `cs:=TZCompressionStream.Create(clMax, dest);`?... – kobik Oct 31 '13 at 19:23
  • 1
    @kobik the code in the question doesn't match that in the comments, so I'm extemporising. Hard to see what else could be the issue. – David Heffernan Oct 31 '13 at 19:24
  • Thank you. The confusion arose between Ttsompressionlevel and TZCompressionLevel // CG: Add overloaded constructor for old parameter type and order constructor Create(compressionLevel: TCompressionLevel; dest: TStream); overload; – Александр Башлаков Oct 31 '13 at 19:28