Ido*_*dov 5 c++ dll inheritance export
我试图从这样的DLL导出一个类及其基类:
#ifdef MY_EXPORTS
#define DECLSPEC_TEST __declspec(dllexport)
#else
#define DECLSPEC_TEST __declspec(dllimport)
#endif
class DECLSPEC_TEST BaseClass
{
// stuff.
};
class DECLSPEC_TEST DerivedClass : public BaseClass
{
// This class only has a constructor which initializes the class differently.
};
Run Code Online (Sandbox Code Playgroud)
但我尝试在另一个DLL中使用此类,我不断收到错误:
error LNK2019: unresolved external symbol
"__declspec(dllimport) public: __thiscall DerivedClass::DerivedClass(void)"
(__imp_??0DerivedClass@@QAE@XZ) referenced in function
"public: __thiscall SomeOtherClass::SomeOtherClass(void)" (??0SomeOtherClass@@QAE@XZ)
Run Code Online (Sandbox Code Playgroud)
我还用PE Explorer查看了我的导出DLL,我在导出列表中看不到派生类.
当我尝试在我的其他DLL中使用基类时,它工作正常.
我究竟做错了什么?
| 归档时间: |
|
| 查看次数: |
6751 次 |
| 最近记录: |