这是调用代码:
#include "lib.h"
using namespace lib;
int
main(const int argc, const char *argv[])
{
return 0;
}
这是库的代码:
#ifndef lib_h
#define lib_h
#include <string>
#include <vector>
#include <memory>
namespace lib
{
class Foo_impl;
class Foo
{
public:
Foo();
~Foo();
private:
Foo(const Foo&);
Foo& operator=(const Foo&);
std::unique_ptr<Foo_impl> m_impl = nullptr;
friend class Foo_impl;
};
} // namespace
#endif
clang++ 给了我这个错误:
'sizeof' 在不完整的类型 'lib::Foo_impl' 上的无效应用
注意:请求成员函数'std :: default_delete ::operator()'的实例化
你可以看到我已经特别声明了 Foo 析构函数。我还错过了什么?