samedi 1 juillet 2017

Interface class produce "Use of undefined type"

ALL,

I have a following code in the foo.h:

class __declspec(dllexport) Foo
{
protected:
    struct Impl;
    Impl *pimpl;
public:
    std::wstring &GetMember() { return pimpl->m_string; };
};

struct Foo::Impl
{
    std::wstring m_string;
};

Unfortunately this code produces an error:

Use of undefined type 'Database::Impl'

Trying to forward declare Database::Impl results in another compiler error.

So what is the best way to fix it?

All this is in one header file.

Aucun commentaire:

Enregistrer un commentaire