当我试图利用 pimpl-idiom 和智能指针来实现我自己的围绕特定于平台的 GUI 组件的包装器时,我遇到了一个我无法解决的问题。问题可能出在 pimpl-idiom 和 *unique_ptr* 上,因为我不知道还有什么问题。所有错误似乎都是链接错误。使用代码时出现各种未定义的参考错误(下面的链接): http ://www.cplusplus.com/forum/general/96020/
以下是错误列表:
> obj\debug_windows\helixirrwidgets\src\helixirrwidgets\Window-windows.o||In
> function `Window':|
> E:\new2\projects\programming\test2\test2\..\..\helixirrwidgets\src\helixirrwidgets\Window.hpp|15|undefined
> reference to
> `HelixirrWidgets::PointerSmartSafe<HelixirrWidgets::Window::Helper,
> std::default_delete<HelixirrWidgets::Window::Helper>
> >::PointerSmartSafe(HelixirrWidgets::Window::Helper*)'| E:\new2\projects\programming\test2\test2\..\..\helixirrwidgets\src\helixirrwidgets\Window.hpp|15|undefined
> reference to
> `HelixirrWidgets::PointerSmartSafe<HelixirrWidgets::Window::Helper,
> std::default_delete<HelixirrWidgets::Window::Helper>
> >::PointerSmartSafe(HelixirrWidgets::PointerSmartSafe<HelixirrWidgets::Window::Helper,
> std::default_delete<HelixirrWidgets::Window::Helper> > const&)'|
> obj\debug_windows\helixirrwidgets\src\helixirrwidgets\Window-windows.o||In
> function `Window':|
> E:\new2\projects\programming\helixirrwidgets\src\helixirrwidgets\Window-windows.cpp|88|undefined
> reference to
> `HelixirrWidgets::PointerSmartSafe<HelixirrWidgets::Window::Helper,
> std::default_delete<HelixirrWidgets::Window::Helper>
> >::PointerSmartSafe(HelixirrWidgets::Window::Helper*)'| E:\new2\projects\programming\helixirrwidgets\src\helixirrwidgets\Window-windows.cpp|91|undefined
> reference to
> `HelixirrWidgets::PointerSmartSafe<HelixirrWidgets::Window::Helper,
> std::default_delete<HelixirrWidgets::Window::Helper>
> >::PointerSmartSafe(HelixirrWidgets::Window::Helper*)'| obj\debug_windows\helixirrwidgets\src\helixirrwidgets\Window-windows.o||In
> function `ZN15HelixirrWidgets6Window12save_changesEv':|
> E:\new2\projects\programming\helixirrwidgets\src\helixirrwidgets\Window-windows.cpp|98|undefined
> reference to
> `HelixirrWidgets::PointerSmartSafe<HelixirrWidgets::Window::Helper,
> std::default_delete<HelixirrWidgets::Window::Helper> >::operator->()
> const'|
> E:\new2\projects\programming\helixirrwidgets\src\helixirrwidgets\Window-windows.cpp|100|undefined
> reference to
> `HelixirrWidgets::PointerSmartSafe<HelixirrWidgets::Window::Helper,
> std::default_delete<HelixirrWidgets::Window::Helper> >::operator->()
> const'|
> E:\new2\projects\programming\helixirrwidgets\src\helixirrwidgets\Window-windows.cpp|101|undefined
> reference to
> `HelixirrWidgets::PointerSmartSafe<HelixirrWidgets::Window::Helper,
> std::default_delete<HelixirrWidgets::Window::Helper> >::operator->()
> const'|
> E:\new2\projects\programming\helixirrwidgets\src\helixirrwidgets\Window-windows.cpp|106|undefined
> reference to
> `HelixirrWidgets::PointerSmartSafe<HelixirrWidgets::Window::Helper,
> std::default_delete<HelixirrWidgets::Window::Helper> >::operator->()
> const'|
> E:\new2\projects\programming\helixirrwidgets\src\helixirrwidgets\Window-windows.cpp|107|undefined
> reference to
> `HelixirrWidgets::PointerSmartSafe<HelixirrWidgets::Window::Helper,
> std::default_delete<HelixirrWidgets::Window::Helper> >::operator->()
> const'|
> E:\new2\projects\programming\helixirrwidgets\src\helixirrwidgets\Window-windows.cpp|109|undefined
> reference to `GetStockObject@4'|
> E:\new2\projects\programming\helixirrwidgets\src\helixirrwidgets\Window-windows.cpp|111|undefined
> reference to
> `HelixirrWidgets::PointerSmartSafe<HelixirrWidgets::Window::Helper,
> std::default_delete<HelixirrWidgets::Window::Helper> >::operator->()
> const'|
> E:\new2\projects\programming\helixirrwidgets\src\helixirrwidgets\Window-windows.cpp|112|undefined
> reference to
> `HelixirrWidgets::PointerSmartSafe<HelixirrWidgets::Window::Helper,
> std::default_delete<HelixirrWidgets::Window::Helper> >::operator->()
> const'|
> E:\new2\projects\programming\helixirrwidgets\src\helixirrwidgets\Window-windows.cpp|114|undefined
> reference to
> `HelixirrWidgets::PointerSmartSafe<HelixirrWidgets::Window::Helper,
> std::default_delete<HelixirrWidgets::Window::Helper> >::operator->()
> const'|
> E:\new2\projects\programming\helixirrwidgets\src\helixirrwidgets\Window-windows.cpp|118|undefined
> reference to
> `HelixirrWidgets::PointerSmartSafe<HelixirrWidgets::Window::Helper,
> std::default_delete<HelixirrWidgets::Window::Helper> >::operator->()
> const'|
> E:\new2\projects\programming\helixirrwidgets\src\helixirrwidgets\Window-windows.cpp|119|undefined
> reference to
> `HelixirrWidgets::PointerSmartSafe<HelixirrWidgets::Window::Helper,
> std::default_delete<HelixirrWidgets::Window::Helper> >::operator->()
> const'|
> obj\debug_windows\helixirrwidgets\src\helixirrwidgets\Window-windows.o:E:\new2\projects\programming\helixirrwidgets\src\helixirrwidgets\Window-windows.cpp|120|more
> undefined references to
> `HelixirrWidgets::PointerSmartSafe<HelixirrWidgets::Window::Helper,
> std::default_delete<HelixirrWidgets::Window::Helper> >::operator->()
> const' follow| ||=== Build finished: 16 errors, 0 warnings ===|
我该如何克服这个问题?