Hello all,<div><br></div><div>I&#39;ve created a simple class, which is a subclass of vtkObject, and tried to use vtkSmartPointer with it. The class is as follows:</div><div><br></div><div><div>class MyClass : public vtkObject</div>
<div>{</div><div>public:</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>MyClass()</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>std::cout &lt;&lt; &quot;BEING CONSTRUCTED&quot; &lt;&lt; std::endl;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>~MyClass()</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>std::cout &lt;&lt; &quot;BEING DESTRUCTED&quot; &lt;&lt; std::endl;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div>};</div>
</div><div><br></div><div><br></div><div>And I&#39;m trying to create a smart pointer for it like this:</div><div><br></div><div>vtkSmartPointer&lt;MyClass&gt; myPtr = vtkSmartPointer&lt;MyClass&gt;::New();</div><div><br>
</div><div>But the instantiation of the object/smartptr generates compiler errors.</div><div>Can anyone help me with that?</div><div><br></div><div>Compiling under Visual C++ 2008, my build log follows:</div><div><br></div>
<div><div>1&gt;------ Build started: Project: TesteVTK, Configuration: Debug Win32 ------</div><div>1&gt;Compiling...</div><div>1&gt;TesteVTK.cpp</div><div>1&gt;c:\users\vinicius\desktop\labmint\vtk\vtk-5.6.0\common\vtksmartpointer.h(113) : error C2665: &#39;vtkSmartPointer&lt;T&gt;::vtkSmartPointer&#39; : none of the 4 overloads could convert all the argument types</div>
<div>1&gt;        with</div><div>1&gt;        [</div><div>1&gt;            T=MyClass</div><div>1&gt;        ]</div><div>1&gt;        c:\users\vinicius\desktop\labmint\vtk\vtk-5.6.0\common\vtksmartpointer.h(163): could be &#39;vtkSmartPointer&lt;T&gt;::vtkSmartPointer(T *,const vtkSmartPointerBase::NoReference &amp;)&#39;</div>
<div>1&gt;        with</div><div>1&gt;        [</div><div>1&gt;            T=MyClass</div><div>1&gt;        ]</div><div>1&gt;        while trying to match the argument list &#39;(vtkObject *, vtkSmartPointerBase::NoReference)&#39;</div>
<div>1&gt;        c:\users\vinicius\desktop\labmint\vtk\vtk-5.6.0\common\vtksmartpointer.h(112) : while compiling class template member function &#39;vtkSmartPointer&lt;T&gt; vtkSmartPointer&lt;T&gt;::New(void)&#39;</div>
<div>1&gt;        with</div><div>1&gt;        [</div><div>1&gt;            T=MyClass</div><div>1&gt;        ]</div><div>1&gt;        c:\users\vinicius\documents\my dropbox\projetos\testevtk\testevtk.cpp(70) : see reference to class template instantiation &#39;vtkSmartPointer&lt;T&gt;&#39; being compiled</div>
<div>1&gt;        with</div><div>1&gt;        [</div><div>1&gt;            T=MyClass</div><div>1&gt;        ]</div><div>1&gt;Build log was saved at &quot;file://c:\Users\Vinicius\Documents\Visual Studio 2008\Projects\TesteVTK\TesteVTK\Debug\BuildLog.htm&quot;</div>
<div>1&gt;TesteVTK - 1 error(s), 0 warning(s)</div><div>========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========</div></div><div><br></div><div><br></div><div><br></div><div>Thanks in advance.</div>