<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-08-10 15:44 GMT+02:00 Shawn Waldon <span dir="ltr"><<a href="mailto:shawn.waldon@kitware.com" target="_blank">shawn.waldon@kitware.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi Elvis,<br><br></div>The problem is this:  Declaring vtkNew<Foo> should be fine when Foo is forward declared.  But when the vtkNew<Foo> is deleted in your destructor, the vtkNew<Foo>'s destructor needs to call Foo->Delete().  So at that point it needs the full definition of Foo.  In your example, if you declare your class's destructor and implement it as {} (use the default) in an implementation file where Foo's header is included this should work.  One of my projects uses vtkNew this way.<br></div></div></div></blockquote><div><br></div><div>Thanks Shawn, that was indeed the problem. Adding empty destructors did the trick.<br><br></div><div>Elvis<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><br></div>HTH,<br></div>Shawn<br></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Wed, Aug 10, 2016 at 8:39 AM, Elvis Stansvik <span dir="ltr"><<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>2016-08-10 14:32 GMT+02:00 Elvis Stansvik <span dir="ltr"><<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>></span><wbr>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hi,<br><br></div>The overview at<br><br>    <a href="https://blog.kitware.com/a-tour-of-vtk-pointer-classes/" target="_blank">https://blog.kitware.com/a-tou<wbr>r-of-vtk-pointer-classes/</a><br><br></div>seems to suggest that forward declaration of a class Foo should be enough to be able to declare a vtkNew<Foo> (e.g. see how vtkTable is used in the code example under "Use of Classes").<br><br></div>But when I try e.g:<br><br>class vtkCompositeTransferFunctionIt<wbr>em;<br>...<br>vtkNew<vtkCompositeTransferFun<wbr>ctionItem> m_functionsItem;<br><br></div>I get<br><br>    error: invalid use of incomplete type ‘class vtkCompositeTransferFunctionIt<wbr>em’<br><br></div><div>Do I really need to include vtkCompositeTransferFunctionIt<wbr>em.h to declare a vtkNew<vtkCompositeTransferFun<wbr>ctionItem> ?<br></div></div></blockquote><div><br></div></span><div>To show more of the context where I'm trying this:<br><br>#pragma once<br><br>#include "VTKWidget.h"<br><br>#include <QObject><br>#include <Qt><br><br>#include <vtkNew.h><br><br>#include <vtkChartXY.h><br>#include <vtkContextView.h><br>#include <vtkCompositeControlPointsItem<wbr>.h><br>#include <vtkCompositeTransferFunctionI<wbr>tem.h><br><br>class QWidget;<br><br>class vtkColorTransferFunction;<br>// Apparently I can't just forward declare these.<br>//class vtkChartXY;<br>//class vtkCompositeTransferFunctionIt<wbr>em;<br>//class vtkCompositeControlPointsItem;<br>//class vtkContextView;<br>class vtkPiecewiseFunction;<br><br>class CompositeTransferFunctionEdito<wbr>r : public VTKWidget<br>{<br>    Q_OBJECT<br><br>public:<br>    enum Mode {<br>        EditColor,<br>        EditOpacity<br>    };<br>    Q_ENUM(Mode)<br><br>public:<br>    CompositeTransferFunctionEdito<wbr>r(vtkColorTransferFunction *colorFunction,<br>                              <wbr>      vtkPiecewiseFunction *opacityFunction,<br>                              <wbr>      Mode mode = EditColor,<br>                              <wbr>      QWidget *parent = 0,<br>                              <wbr>      Qt::WindowFlags flags = Qt::WindowFlags());<br><br>    void setColorFunction(vtkColorTrans<wbr>ferFunction *colorFunction);<br>    void setOpacityFunction(vtkPiecewis<wbr>eFunction *opacityFunction);<br><br>signals:<br>    void functionsModified();<br><br>private:<br>    void editColorPoint();<br><br>private:<br>    vtkNew<vtkCompositeTransferFun<wbr>ctionItem> m_functionsItem;<br>    vtkNew<vtkCompositeControlPoin<wbr>tsItem> m_pointsItem;<br>    vtkNew<vtkChartXY> m_chart;<br>    vtkNew<vtkContextView> m_contextView;<br>};<br><br></div><div>I had hoped I would only have to forward declare the types used in the instantiations of vtkNew here, not include the full headers.<br><br></div><div>Elvis<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>Thanks,<br></div><div>Elvis<br></div></div>
</blockquote></div><br></div></div>
<br></div></div>______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensou<wbr>rce/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FA<wbr>Q</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div>