简体   繁体   中英

undefined symbol when loading shared library

I'm sorry about the vagueness of this post, but I'm not able to share the code, and anyway, it would be too much to share anyway.

I have this shared library, "shared", which is loaded by another library. The problem is that when loading the shared library, I get the error message saying "undefined symbol: _ZplPKcRK18ExampleClass"

The problem I have is that ExampleClass is declared and defined in the shared library. I made sure that I the ExampleClass is properly defined, and that the .h and .cpp are actually getting compiled.

I'm really confused about this, so any insight would be really helpful.

I'm building using cmake 3.6.2 and gcc 4.8.5 on CentOS 7.

This is a problem that usually occurs when loading in a shared library and then trying to code from that library. Since linking of the library did not happen directly after compile time, you will not get any linker errors that would be associated with the file and what is dynamically loading it. Look into a demangler(c++filt) and try to get more information about what that "_ZplPKcRK18ExampleClass" references.

In my experience, it is usually something along the lines of a method signature mismatch and the code does not know where to branch after the library is loaded.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM