Ad Space — Top Banner

Unresolved External

C++ Builder Programming Language

Severity: Moderate

What Does This Error Mean?

An unresolved external error from the C++ Builder linker means the linker found that a function or variable is referenced in compiled code but could not find its implementation anywhere. The error names the symbol: [Linker Error] Unresolved external '_FunctionName' referenced from 'Unit.obj'. Adding the missing .lib library or .cpp file to the project resolves it.

Affected Models

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

Common Causes

  • A required .lib library is not in the project's Library Path or Additional Libraries setting
  • A .cpp file containing the function definition was not added to the project group
  • The function was declared but never implemented
  • A calling convention mismatch between the declaration and definition
  • A static class member variable declared in the header but never defined in a .cpp

How to Fix It

  1. Identify the missing symbol from the error message. Search your project for its definition (not just its declaration in a header).

    A definition provides the function body: void MyFunc() { ... } A declaration only introduces the name: void MyFunc(); The linker needs the definition.

  2. Add the required .lib file to the project. Go to Project > Options > C++ Linker > Libraries and add the .lib filename.

    Third-party libraries supply both a header (.h or .hpp) for compilation and a .lib for linking. Both must be in place: the header tells the compiler the function exists, the .lib tells the linker where the code is.

  3. Check that every .cpp file containing function definitions you use is part of the Project Manager. Right-click the project and choose Add to include missing files.

    Files on disk that are not in the project are not compiled into the build. The Project Manager shows exactly what will be compiled and linked.

  4. For static member variables, add a definition in exactly one .cpp file: int TMyClass::Count = 0;

    Static class members declared in the header (static int Count;) must be defined in a .cpp file. Omitting this definition is the most common non-obvious cause of unresolved external errors.

Frequently Asked Questions

What is the difference between E2268 and an unresolved external?

E2268 is a compiler error: the function has not even been declared — no header was included. An unresolved external is a linker error: the function was declared (header included, compiler happy) but no implementation was found at link time. Fix E2268 first — it means the header is missing entirely.

I have 40 unresolved external errors — is the project broken?

Probably not — 40 unresolved externals usually come from one missing .lib. Add the library, rebuild, and most errors will likely clear. Search for the first named symbol in a search engine with 'C++ Builder' to identify which library it belongs to.