Using C++ Builder 10.3 Update 2
I'm upgrading some existing software from classic Borland compiler to Clang 64.
The entire project consists of a number of static libraries, and some applications.
When building the final applications, I'm running into linker issues that look like this:
[ilink64 Error] Error: Unresolved external 'std::_Facet_base::_Facet_base()' referenced from XXX.A|xxx.o
[ilink64 Error] Error: Unresolved external 'vtable for std::locale::facet' referenced from XXX.A|xxx.o
[ilink64 Error] Error: Unresolved external 'vtable for std::ctype_base' referenced from XXX|xxx.o
The libraries are using std::stringstream, and std::readline, along with some other std library functions. The general pattern that is causing the error is:
// mystaticlib.h
void foo();
// mystaticlib.cpp
#include <sstream>
void foo() {
stringstream ss;
// do some more stuff
}
// myapp.cpp
#include "mystaticlib.h"
void bar()
{
foo();
}
Is this a bug with the compiler/linker?
I've found these related questions (and more):
- Undefined reference to vtable
- Linking error: undefined reference to `vtable for XXX`
- Linker error: undefined reference to vtable
But the answers generally boil down to "implement the missing functions". Since this is the std library delivered with the product, I'm hesitant to start changing it.
I'm fairly familiar with C++ Builder, and C++ and I've tried investigating all the basic stuff. This code did compile, link and run using C++ Builder 10.3 with the classic 32 bit compiler. This is so low level that I'm having a hard time figuring out what is wrong.
Because of reasons, I would prefer not to update to 10.4 at this time. I also saw that there is a 10.3.3 release, but I was hoping not to upgrade unless I specifically had to to fix this problem.