Ad Space — Top Banner

E2268

C++ Builder Programming Language

Severity: Moderate

What Does This Error Mean?

E2268 means the compiler found a function call but has no declaration or definition for that function. The message reads: [BCC64 Error] E2268 Call to undefined function 'FunctionName'. Adding the missing #include header or adding the .cpp file to the project group fixes it.

Affected Models

  • C++ Builder 10.x (Alexandria)
  • C++ Builder 11 (Sydney)
  • C++ Builder 12 (Athens)
  • RAD Studio 11 and 12

Common Causes

  • The function's header file is not #included at the top of the source file
  • The .cpp file containing the function implementation is not part of the project group
  • A typo in the function name — C++ Builder is case-sensitive
  • The function is declared in the header but was never implemented in the .cpp
  • A required library unit (.lib or .bpl) is not linked to the project

How to Fix It

  1. Check that the header declaring the function is #included at the top of the file. Look up which header the function belongs to.

    VCL functions are declared in VCL headers — TForm needs Vcl.Forms.hpp, TStringList needs System.Classes.hpp, etc. Include the correct header and the error should clear.

  2. If the function is in your own code, make sure its .cpp file is included in the Project Manager. Right-click the project in the Project Manager and use Add to add the file.

    Files on disk that are not in the project group are not compiled or linked. The Project Manager tree must show the .cpp for its symbols to be available.

  3. Check the spelling and case of the function name exactly as it appears in its declaration.

    C++ is case-sensitive: getvalue(), getValue(), and GetValue() are three different functions. Use Ctrl+Click on the function name in the editor to jump to its declaration and confirm the exact name.

  4. If the function comes from a third-party library, add its .lib file to the project. Go to Project > Options > C++ Linker > Libraries and add the .lib path.

    Third-party libraries supply a header for declarations and a .lib for the implementations. Both are needed: the header to compile, the .lib to link.

Frequently Asked Questions

What is the difference between E2268 and a linker unresolved external error?

E2268 is a compiler error — the compiler has not seen a declaration of the function at all. An unresolved external is a linker error — the compiler found a declaration (from a header) but the linker cannot find the implementation (.cpp or .lib). E2268 means the header is missing; unresolved external means the implementation is missing.

Can E2268 appear for a VCL method that definitely exists?

Yes — if the correct VCL header is not included, C++ Builder does not know the VCL method exists. VCL headers are not automatically included unless you include them. Add the appropriate #include for the VCL class at the top of your .cpp file.