Visual Studio 2010, TR1 and Boost.

By , last updated June 4, 2010

When porting projects from Visual Studio 2008 or earlier to Visual Studio 2010, and you’re using boost::shared_ptr or other features present in TR1, there will be conflicts. Boost has their own implementation of shared_ptr in boost::shared_ptr and with VS2010 they have put shared_ptr in std::tr1 and they have made shared_ptr available through std::shared_ptr. When using using namespace std; and using namespace boost; there will be ambiguities.

To disable the C++0x/TR1 headers from VS2010 and use the boost implementation, define _HAS_CPP0X=0 in the preprocessor project settings for your VS2010 project. 

Select "All Configurations" and then add the preprocessor directive.


  1. Rick.Renfrew July 28, 2010 Leave a Reply

    Just a heads up, I stumbled across this blog post when trying to do exactly what you were talking about (disable TR1 in VS2010). I actually had to set _HAS_CPP0X to 0, though, instead of 1 in order to disable the built-in TR1 implementation so I could use boost.

    I found several places that said to set the macro to 1, so I’m not sure if this was changed recently or something like that. In either case, I figured I’d post this here, hopefully it’ll help whoever comes across this next :D. Thanks for the informative post!

  2. kent July 28, 2010 Leave a Reply


    It should of course be _HAS_CPP0X=0 to disable the headers. My mistake.

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>