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:
https://docs.google.com/drawings/d/1C-b5hCN0SwKREtbx0xIN0c37EGWcm-dWSvj8mpudi_w/edit?usp=sharing
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:
https://github.com/bitmage/zdb/blob/68756e843817bb2b85583de877b6c1cf2956e68d/src/transport/connection.h#L53-L55
KafkaConnection.h defines an override:
https://github.com/bitmage/zdb/blob/68756e843817bb2b85583de877b6c1cf2956e68d/src/transport/kafka/kafka_connection.h#L31-L33
KafkaConnection.cc defines the implementation:
https://github.com/bitmage/zdb/blob/68756e843817bb2b85583de877b6c1cf2956e68d/src/transport/kafka/kafka_connection.cc#L53-L122
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?
Thanks!
Brandon