开发者

GCC linker error when building for iPhone

Undefined symbols:
"vtable for NameSpaceA::NameSpaceB::ClassA", referenced from:
__ZTVN4NameSpaceA17NameSpaceB15ClassAE$non_lazy_ptr in libSomeLib.a(SomeLib.bulk.o)
(maybe you meant: __ZTVN4NameSpaceA17NameSpaceB15ClassAE$non_lazy_ptr)

for some classes that are build in this lib. Same code compiles and links fine on Windows. Other classes from same lib are linked fine on Mac too. I don't have any build errors, only linker errors. Can you tell me some reasons for this kind of error开发者_开发技巧s? I think that all virtual functions are implemented because it compiles and links fine on other platforms(not only Windows).


In order for gcc to emit the vtables, each of your (polymorphic) classes needs to have at least one virtual, non-inline method. For example if your virtual destructor is inline currently, un-inline it and move it to the source file and that should fix it up.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜