开发者

meaning of C++ runtime linking error?

I am getting following runtime error.

anyfile.c开发者_Python百科pp (60) : E_FATAL : Could not start process libprocbase_so.so (/opt/company/processes/sharedbase_so.so: undefined symbol: _ZTV16CResourceManager)

I found that meaning of _ZTV16CResourceManager is virtual table of Resource Manager,

Any idea why it is coming? how to solve it?


The problem is that while loading the dynamic libraries (sharedbase_so.so) it has not been able to resolve the symbol. Try to locate in what library (if any) the symbol is defined and ensure that ld can load it (add it to the path). If it is not present in any dynamic library, go back to the object files and try to determine where it is and why it did not make it to the binary.

A common situation where this can be an issue is with classes that are mostly defined inlined, like:

struct test {
   virtual void foo() {}
   //virtual void bar();
};

If the line with bar is commented out, then the compiler will generate the vtable as a weak symbol in all translation units that include it. If bar is uncommented, the compiler will not generate the vtable in each translation unit, but only in the translation unit that defines test::bar. Make sure that even if you do not use test::bar, the object file gets linked in the library.


Where did you declare the class ResourceManager ?

It seems that this library is not loaded - when you use runtime linking, you have to load all dependencies by hand in the correct order.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜