Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
[C++ Error] shared_ptr.hpp(124): E2034 Cannot convert 'Y *' to 'Widget *'
IDE: C++ Builder 6.0
Compiler: Borland BCC32.EXE version 6.0.10.157
Boost version: 1.35.0.
A boost::shared_ptr is either uninitialized or initialized with a pointer. Initializing with 0 is not a valid initialization and therefore not possible.
#include <boost/shared_ptr.hpp>
{
boost::shared_ptr<Widget> w(0); //ERROR! Cannot initialize with 0
//Should be the code below:
//boost::shared_ptr<Widget> w(new Widget);
}
Initialize the boost::shared_ptr.
#include <boost/shared_ptr.hpp>
{
boost::shared_ptr<Widget> w(new Widget);
}
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.