I'm in the process of abstracting the transport used for queueing in the OSS project ZDB. I've built an inheritance diagram that looks like this:
Here is the error I'm getting when building:
Undefined symbols for architecture x86_64:
"zdb::Connection::connect(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
construction vtable for zdb::ConsumerConnection-in-zdb::KafkaConsumerConnection in kafka_connection.o
construction vtable for zdb::ProducerConnection-in-zdb::KafkaProducerConnection in kafka_connection.o
I get other errors of the same variety, for methods that I've declared virtual in an abstract class and am overriding in a concrete class. But I think if we solve this one it will point me to the right answers for the others.
Here's the specific definitions that I think are relevant for this case.
Connection.h defines virtual connect method:
KafkaConnection.h defines an override:
KafkaConnection.cc defines the implementation:
Given that the concrete class being instantiated is KafkaConsumerConnection, and that it inherits from KafkaConnection which provides the implementation, I don't understand why the symbol cannot be found during linking. What am I doing wrong?