Visual Studio 2010 Building Error

Hi, I have been working previously with Visual Studio 2008 and I haven't had any problem with my actual code. I needed to migrate my whole solution to Visual Studio 2010 and now I get the following error: - error C2664: 'boost::shared_ptr<T>::shared_ptr(boost::shared_ptr<T> &&)' : cannot convert parameter 1 from 'std::tr1::shared_ptr<_Ty>' to 'boost::shared_ptr<T> &&' Do you have any clue or advice on how to solve it? Greetings! -- Abdullah García

Hello Abdullah, I have had this problem also. From VS2010 there is also a shared_ptr in the std namespace (C++0X), which has the same function as the Boost shared_ptr. Probably there is a namespace clash somewhere in your code (both std and boost declared) without using the explicit namespace. Greetings, Jan On 11 feb 2011, at 15:13, Abdullah García wrote:
Hi,
I have been working previously with Visual Studio 2008 and I haven't had any problem with my actual code. I needed to migrate my whole solution to Visual Studio 2010 and now I get the following error:
error C2664: 'boost::shared_ptr<T>::shared_ptr(boost::shared_ptr<T> &&)' : cannot convert parameter 1 from 'std::tr1::shared_ptr<_Ty>' to 'boost::shared_ptr<T> &&'
Do you have any clue or advice on how to solve it?
Greetings!
-- Abdullah García _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Met vriendelijke groet, Jan Krabbenbos jan.krabbenbos@gmail.com

Abdullah García wrote:
Hi,
I have been working previously with Visual Studio 2008 and I haven't had any problem with my actual code. I needed to migrate my whole solution to Visual Studio 2010 and now I get the following error:
error C2664: 'boost::shared_ptr<T>::shared_ptr(boost::shared_ptr<T> &&)' : cannot convert parameter 1 from 'std::tr1::shared_ptr<_Ty>' to 'boost::shared_ptr<T> &&'
You are using both boost::shared_ptr and std::tr1::shared_ptr in your code, and attempt to assign one to the other. Under Visual Studio 2008 (and, I assume, Boost.TR1) they are the same. Visual Studio 2010 has its own std::tr1::shared_ptr which is not the same as boost::shared_ptr.

You are using both boost::shared_ptr and std::tr1::shared_ptr in your code, and attempt to assign one to the other. Under Visual Studio 2008 (and, I assume, Boost.TR1) they are the same. Visual Studio 2010 has its own std::tr1::shared_ptr which is not the same as boost::shared_ptr.
VS2008 already had its own tr1::shared_ptr. But under VS 2010 shared_ptr became also a part of std.

Hi everyone,
Thanks a lot for your explanation. I don't have a clue on how to solve it.
Did you actually were able to solve it? How?
Greetings!
On Sat, Feb 12, 2011 at 5:34 PM, Igor R
You are using both boost::shared_ptr and std::tr1::shared_ptr in your code, and attempt to assign one to the other. Under Visual Studio 2008 (and, I assume, Boost.TR1) they are the same. Visual Studio 2010 has its own std::tr1::shared_ptr which is not the same as boost::shared_ptr.
VS2008 already had its own tr1::shared_ptr. But under VS 2010 shared_ptr became also a part of std. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Abdullah García

Hi Igor,
I have a "using namespace std;" codeline. What should I do with this
codeline?
Greetings!
On Sun, Feb 13, 2011 at 2:41 PM, Igor R
Thanks a lot for your explanation. I don't have a clue on how to solve it. Did you actually were able to solve it? How?
Do you have any "using namespace std;" directive or "using std::shared_ptr;" in your code? It may be the cause of the abmiguity you encoutered. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Abdullah García

Hi Abdullah -
You could remove it, and replace it by specific "using" cases, i.e.
"using std::cerr", or not apply a using clause at all, and specify the
namespace when you use it.
Brian
2011/2/13 Abdullah García
Hi Igor,
I have a "using namespace std;" codeline. What should I do with this codeline?
Greetings!
On Sun, Feb 13, 2011 at 2:41 PM, Igor R
wrote: Thanks a lot for your explanation. I don't have a clue on how to solve it. Did you actually were able to solve it? How?
Do you have any "using namespace std;" directive or "using std::shared_ptr;" in your code? It may be the cause of the abmiguity you encoutered. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Abdullah García
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

I have a "using namespace std;" codeline. What should I do with this codeline?
This line brings std::shared_ptr to the global namespace. I guess, you've also got somewhere "using namespace boost;" or "using boost::shared_ptr". What you can try and do now is to replace all the references to unqualified "shared_ptr" in your code with "boost::shared_ptr".
participants (5)
-
Abdullah García
-
Brian Budge
-
Igor R
-
Jan Krabbenbos
-
Peter Dimov