Preamble
Working with a large piece of code, which I can’t break into MCVE right now , so I’ll do my best.
Problem
I am working with a large project that compiled as a static library, libfoo.a . A separate project, bar , references this library. The “offensive” snippet in libfoo as follows:
class Base { public: void foo(){} void bar(){} }; class Derived : private Base { public: using Base::foo; };
Both libfoo and bar extensive use of boost . bar must be compiled with -std=c++11 because of the C ++ 11 features it uses, but libfoo can be compiled with minimal parameters (i.e. -std=c++0x default compiler options used by GCC v4.8 , which looks like -std=gnu++03 ).
When I try to bind bar with -std=c++0x GCC, the default compiled libfoo.a fails with a long warning with a name that reduces to:
Undefined reference to Base::Derived::foo()
When I rebuild libfoo.a with -std=c++11 , this problem no longer occurs.
Work longer
I compared the output of libfoo.a via nm , and in both cases the corresponding characters were present. I also went through the Cxx11Abi compatibility docs , and it doesn't seem like this compiler option should “break” the compatibility.
Question
What is the cause of this linker problem?
source share