Ad Space — Top Banner

E2249

Delphi Programming Language

Severity: Moderate

What Does This Error Mean?

Delphi error E2249 means the compiler could not find an overloaded version of a class method that matches the arguments you provided. Delphi has multiple versions of the method (overloads) but none of them accept the exact combination of argument types you used. The fix is to check the available overloads in the documentation and match your argument types, or to add a cast.

Affected Models

  • Delphi 10.4 Sydney
  • Delphi 11 Alexandria
  • Delphi 12 Athens
  • Embarcadero RAD Studio
  • Free Pascal / Lazarus

Common Causes

  • Calling a class method with argument types that do not match any overloaded version
  • Passing an Integer where a specific overload expects a Cardinal, or vice versa
  • Mixing AnsiString and UnicodeString arguments in an overloaded call
  • A recent Delphi version added or removed an overload, making existing code ambiguous or unmatchable
  • A generic method overload is not being selected because the type parameter cannot be inferred

How to Fix It

  1. Read the full error message — it names the class and method, e.g., 'No matching overloaded class method found for Create(Integer, String)'. Note the argument types you passed.

    The error lists the argument types the compiler saw. This is what you need to match against the available overloads.

  2. In the IDE, Ctrl+click the method name to jump to its declaration. Read all the overloaded versions to see which parameter types each overload accepts.

    Code insight (Ctrl+Space or auto-popup) also shows all overloads in a tooltip when your cursor is inside the argument list.

  3. Add an explicit type cast to match the expected overload. For example, if the method expects a string but you have a Variant: MyMethod(string(MyVariant)).

    Delphi's overload resolution is strict — an Integer and a Cardinal are different types and will not match each other's overloads automatically.

  4. If the method is in your own class, add the missing overload. Declare the method with the overload directive and the parameter types you need: procedure DoIt(Value: Integer); overload;

    All overloaded versions of a method must include the overload directive — including the first one.

  5. Check for Delphi version differences. If the error appeared after an upgrade, the overload signature may have changed. Check the release notes or compare the VCL source with the previous version.

    RTL and VCL methods sometimes gain or lose overloads between Delphi versions, requiring updates to calling code.

When to Call a Professional

E2249 is a compile-time error — the project will not build until it is resolved. Hover over the method name in the IDE to see all available overloads via code insight. Add an explicit cast to match one of the available overloads, or add the missing overload to the class if you own it.

Frequently Asked Questions

What does the overload directive do in Delphi?

The overload directive tells the compiler that multiple versions of a method with the same name are intentional. Without it, having two methods with the same name in the same class is a compile error. With it, the compiler selects the correct version based on the argument types at the call site.

Can E2249 occur with constructors?

Yes. Constructors are methods and can be overloaded. If you call Create with arguments that do not match any constructor overload, you get E2249. The most common case is calling TStringList.Create with an argument when it only accepts no arguments.

Is there a way to see all overloads of a method quickly in the Delphi IDE?

Yes. Place your cursor inside the argument list of the method call and press Ctrl+Shift+Space to show parameter hints. The IDE shows all overloads with their parameter types. You can cycle through them with the arrow keys to see each version.