문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top