0

I checked all the functions for base class and current and there is no virtual function without implementation.

And I also used 'nm -C mycode.o > log' and find there are no functions for my class is "V". But in the log I did get:

U typeinfo for mychild
V typeinfo for myparent

As the code is very large, not uploaded the code. And I am using gcc/4.8. Wondering

  1. is there any tool can help to give more information?
  2. except for forgetting implementation of a virtual function, is there any other common reason for such error?
melpomene
  • 84,125
  • 8
  • 85
  • 148
user2191818
  • 39
  • 1
  • 4
  • Note that it is not enough for all virtuals to have an implementation. At least one of those implementations has to be outside a header - in a implementation file. – Jesper Juhl Aug 13 '16 at 16:15
  • @JesperJuhl , Yes, I have most of functions (not all, 4 function declared and implemented in the header) declared in the header file and put all implementations in the cpp file – user2191818 Aug 13 '16 at 16:18
  • @SamVarshavchik As I mentioned in the words, I would like more to know a tool or the method to debug similiar issue other than solve my current problem – user2191818 Aug 13 '16 at 16:29
  • You already know the tool: `nm`. It tells you exactly what each translation unit defines, and each translation unit's unresolved references. This is a complete set of information needed to analyze link errors. There's no other information that could possibly be needed. Unfortunately, there is no magic button anywhere that, once pressed, states the underlying reason why a link fails, and what must be done to fix it. Either there's an unresolved ref that shouldn't be there, or the ref did not get compiled, or it's missing from the link. That's it. – Sam Varshavchik Aug 13 '16 at 16:31

0 Answers0