How to fix linker error unresolved external std::locale::id::id in C++ Builder

1k Views Asked by At

When compiling a C++ Builder 10.4 project, I get the following linker error:

[ilink32 Error] Error: Unresolved external 'std::locale::id::id(unsigned int)' referenced from C:\USERS\PUBLIC\DOCUMENTS\EMBARCADERO\STUDIO\21.0\DCP\SCREEN2VIDEO.LIB|Screen2Video

This linker error happens when 'Link with dynamic RTL', and 'Link with run-time packages' are turned off. When linking with dynamic RTL, the linker error does not occur, but I want to link statically.

The SCREEN2VIDEO.LIB is from a package containing an imported ActiveX control.

2

There are 2 best solutions below

0
On

Same issue here, with C++ Builder 11 though. It turned out to be a problem of the optimizer. Try disabling all optimizations. Also check out one of the related bug reports at Embarcadero: https://quality.embarcadero.com/browse/RSP-29221

Edit: I experimented a bit more and found the problematic compiler flag. It is -finline-functions which is implicitely added when using -O2 or higher. Therefore, as a workaround, you can add -fno-inline-functions to C++ compiler > Advanced > Additional Options to make it work without too much of a performance impact at least.

I also added this info to the above bug-report.

0
On

Recompile all dependent packages (including the screen2video.bpl) with dynamic RTL turned off. This fixed the linker error.