laika
laika

Reputation: 37

Borland C++ Builder 4 [Linker Error] Unresolved external

I'm trying to compile an old project in Borland C++ Builder 4. I have a working exe and the source files for that, therefore someone must have managed to compile it earlier. However, when I open the project, check if the project hs all the necessary files in the resources and try to compile it, I keep getting the following linker error:

[Linker Error] Unresolved external '_fastcall TMapperForm::Button1Click(System::TObject*)' referenced from ...\Unit1.obj

I can see that it cannot find an object in the library but I am not sure how to resolve it, because the obj file with the same name as the main cpp file is in the same file as the other files of the project and seems fine.

I have looked through the answers provided here for similar linker errors but none of what these have suggested worked for me. I have already tried the following:

None of this seems to work. I am fairly new to C++ and C++ Builder, so I am hoping that it is something trivial.

Has anybody seen this particular error?

Upvotes: 1

Views: 6581

Answers (1)

laika
laika

Reputation: 37

The error was caused by a missing handler or more precisely a handler containing nothing.

While the handler for the button contained nothing, the TMapperForm class still included the definitions for an extra button named Button1 but it was not used. Commenting out the method and the declaration in the TMapperForm class (in the header file for Unit1) along with the handler in the C++ file resolved the problem.

Upvotes: 0

Related Questions