Reputation: 389
Help! I have three classes; Point, Neuron, and CumulativeNeuron. And I have source file neurones.cpp. when I link my files it says:
~/Desktop/assign-8$ g++ point.o neuron.o cumulativeNeuron.o neurones.o
cumulativeNeuron.o:(.rodata._ZTI16CumulativeNeuron[_ZTI16CumulativeNeuron]+0x10): undefined reference to `typeinfo for Neuron'
collect2: error: ld returned 1 exit status
I can't understand this error! please help Thanks.
Upvotes: 0
Views: 45
Reputation: 44181
You have forgotten to implement (or perhaps to link) the first virtual
function in the Neuron
class. Several compilers generate the RTTI type info for a class at the point where the first virtual function is implemented. If you forget to implement that function, no type info is generated and linking fails.
Upvotes: 1