g++ undefined reference to typeinfo

I just ran across the following error (and found the solution online, but it’s not present in Stack Overflow):

(.gnu.linkonce.[stuff]): undefined
reference to [method] [object
file]:(.gnu.linkonce.[stuff]):
undefined reference to `typeinfo for
[classname]’

Why might one get one of these “undefined reference to typeinfo” linker errors?

(Bonus points if you can explain what’s going on behind the scenes.)

18 Answers
18

Leave a Comment