Re: [Boost-users] shared_ptr compile error ms vc++ 8
I am using VC++ 2005 Express Edition v 8.0.050727.42. When compiling the following line in a file example.cpp; boost::shared_ptr<int> p(new std::string) the following error is produced (note the explicit mention of example.cpp(10) ): c:\Projects\boost\shared_ptr.hpp(125) : error C2440: 'initializing' : cannot convert from 'std::string *' to 'int *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast .\example.cpp(10) : see reference to function template instantiation 'boost::shared_ptr<T>::shared_ptrstd::string(Y *)' being compiled with [ T=int, Y=std::string ] regards, Andrew McDonald System Architect Norwood Systems Australia Pty Ltd Level 1, 71 Troy Terrace PO Box 1281 Subiaco, WA 6904 Tel +61 8 9380 7766 Fax +61 8 9380 7733 The information in this email, and any attachments, may contain confidential information and is intended solely for the attention and use of the named addressee (s). It must not be disclosed to any person(s) without authorization. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are not authorized to, and must not, disclose, copy, distribute, or retain this message or any part of it. If you have received this communication in error, please notify the sender immediately.
Andrew McDonald wrote:
I am using VC++ 2005 Express Edition v 8.0.050727.42.
When compiling the following line in a file example.cpp;
boost::shared_ptr<int> p(new std::string) --------------------^^^-------------^^^^^^
int type is not a string type, and the other way. Best regards -- Mateusz Loskot http://mateusz.loskot.net
participants (2)
-
Andrew McDonald
-
Mateusz Loskot