我用MSVS制作了一个Dll,并成功使用pimpl方法,如下所示:
包含文件:
#include <memory>
#define DllExport __declspec( dllexport )
namespace M
{
class P
{
public:
DllExport P(/*some arguments*/);
DllExport ~P();
DllExport int aFunction (/* some arguments*/);
private:
class C;
std::unique_ptr<C> mc;
};
}
私有包含文件:
namespace M
{
class P::C
{
public:
# Other variables and functions which are not needed to be exported...
}
}
>
和cpp文件:
DllExport M::P::P(/*some arguments*/):mc(std::make_unique<C>())
{
# ...
}
DllExport M::P::~P(){ }
DllExport int aFunction (/* some arguments*/)
{
#...
}
现在,我想在Qt Creator中实现这种方法。我应该进行哪些更改?
((我想我必须使用QScopedPointer而不是unique_ptr,但是对此最好的实现形式是什么?)
PS:我将clang设置为编译器。