Boost C++ Libraries: Ticket #71: shared_ptr https://svn.boost.org/trac10/ticket/71 <pre class="wiki">I have used the shared_ptr class in some code I wrote a couple of years ago using Microsoft Visual C++ 5.0, and it worked great! Now I am trying to re-compile this code using Microsoft Visual C++6.0 and am getting some errors. I have tried everything I can think of, including getting the latest version of the library from the boost web site, but I am still getting the same error. I am using the shared_ptr with a class called 'CVFolder'. The code is something like this. CVFolder* pFolder = new CVFolder(); class boost::shared_ptr&lt;class CVFolder&gt;* pSharedPtr; pSharedPtr = new boost::shared_ptr&lt;CVFolder&gt;(pFolder); When I compile, I get the following error. error C2514: 'boost::shared_ptr&lt;class CVFolder&gt;' : class has no constructors Again, this error did not occur with VS5.0 Any help is appreciated. Thanks Mike </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/71 Trac 1.4.3 nobody Thu, 02 May 2002 23:12:41 GMT <link>https://svn.boost.org/trac10/ticket/71#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/71#comment:1</guid> <description> <pre class="wiki">Logged In: NO Your code looks bogus. It should be written // declare your shared pointer to point on CVFolder // and assign to it you newly allocated object boost::shared_ptr&lt;CVFolder&gt; pSharedPtr( new CVFolder() ); This is all done in one instruction. If you need to do it in two instructions here is how it should be written // declare the pointer variable boost::shared_ptr&lt;CVFolder&gt; pSharedPtr; // assign to it the newly created object pSharePtr.reset( new CVFolder() ); Note that for assignement between shared_ptr you can use the = operator. // declare another shared_ptr variable boost::shared_ptr&lt;CVFolder&gt; pOtherSharedPtr; // assign shared_ptr value using = pOtherSharedPtr = pSharedPtr; It will only work between shared_ptr. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Peter Dimov</dc:creator> <pubDate>Wed, 28 May 2003 12:15:23 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/71#comment:2 https://svn.boost.org/trac10/ticket/71#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> Ticket