开发者

Linking error: Missing symbol but symbol exported (in exp and lib)

开发者 https://www.devze.com 2022-12-09 01:10 出处:网络
I have a dynamic library (plugin) that uses another dynamic library (dependency). I use the dependency in two ways:

I have a dynamic library (plugin) that uses another dynamic library (dependency). I use the dependency in two ways: a. by instantiating object from classes defined in the dependency b. by inheriting from classes defined in the dependency

When doing a., there are no linking errors. But when doing b., I have a linking error stating that I am missing some symbols (LNK2001). I looked in the .lib/.exp for the exact mangled name and did find the symbol that MSVC开发者_JS百科 (2005) says is missing.

It might be important to say that I use Qt and that the missing symbols are symbols that are automatically generated in the moc files (staticMetaObject of the parent class). Also, it might be relevant to say that I get these errors in both debug and release, which means that they are not "optimized away" (I even tried /OPT:NOREF /OPT:NOICF, although its the default in debug builds and that the symbols are in the lib file...)

How can I have this linking error even though the symbols are in there? And most importantly, how can I fix these errors?

Thanks for any help!


You might want to make sure the class is being declared with __declspec(dllexport) (when building) and __declspec(dllimport) (when linking against)?

See this link.

0

精彩评论

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