我有一个我需要导出到DLL的库。如果我使用__declspec(dllimport) / __declspec(dllimport)
标记基类的虚方法,则子类抛出:
unresolved external symbol "public: virtual void __thiscall...**
以下是我的代码的样子:
globals.h
#ifdef _WIN32
#ifdef _EXPORTING
#define MYAPI __declspec(dllexport)
#else
#define MYAPI __declspec(dllimport)
#endif
#else
#define MYAPI
#endif
base.h
class BaseClass :boost::noncopyable
{
public:
virtual MYAPI void DoSmth1() {
};
virtual MYAPI void Dosmth2() {
};
};
subclass.h:
class SubClass: public BaseClass
{
public:
MYAPI void DoSmth1();
MYAPI void Dosmth2() ;
};
虚拟方法应该以不同方式导出吗?