1

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):

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.

Turtle1363
  • 312
  • 3
  • 16
  • 1
    What does *I've tried investigating all the basic stuff* mean? Have you read https://stackoverflow.com/q/12573816/62576? – Ken White Jan 07 '21 at 20:05
  • @KenWhite, yes to those steps. What is failing is a few pieces of the std library, not user code. The user code is existing code that built under the 32 bit Borland compiler. What I've been having to do is move everything to headers and inline so that the final application generates the constructor and the vtable. This doesn't seem "right" though to have to do this? – Turtle1363 Jan 07 '21 at 22:44
  • Of course. Linker errors are not runtime errors; they happen when the executable is being linked. That's specifically what the link I posted addresses. The issue you're having is with a library that contains those functions is not being found, so the linker doesn't know what to do with them. Read the link I posted above. And *yes to those steps* does not answer my question about *I've tried investigating all the basic stuff* means. What **specifically** have you investigated? Knowing that is relevant, so we don't waste our time telling you to do things you've already done. – Ken White Jan 07 '21 at 22:51

0 Answers0