Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8002453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:22:21+00:00 2026-06-04T16:22:21+00:00

trying to compile old project that has many uses of shared_ptr with the vs2010.

  • 0

trying to compile old project that has many uses of shared_ptr with the vs2010.
so, i have precompiled header (stdafx.h) with:

..
using namespace std;
..

#include “boost/shared_ptr”
using namespace boost;

and later in the code i intensively use shared_ptr spObject;

What should I change in the stdafx.h so that I will no need to replace everywhere in the code *shared_ptr* to *some_namespace::shared_ptr*?
Is it possible to do without namespace conflicts of boost/boost::tr1/std::tr1/std?

Now I have a lot of errors:

error C2872: ‘shared_ptr’ : ambiguous symbol
could be ‘k:\boost10\boost\smart_ptr\shared_ptr.hpp(165) : boost::shared_ptr’
or ‘c:\program files (x86)\microsoft visual studio 10.0\vc\include\memory(1418) : std::tr1::shared_ptr’

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:22:24+00:00Added an answer on June 4, 2026 at 4:22 pm

    Don’t put using namespace in headers, as you’ve discovered it can break headers that follow, and because you can’t change those headers there isn’t much you can do about it.

    At function scope you can use a using declaration to disambiguate:

    void f()
    {
      using std::tr1::shared_ptr;
      shared_ptr<int> p;
    }
    

    But that won’t work in the global namespace, because you’ve already polluted that scope with the careless using directives.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to compile an old project for my company, which uses
I'm trying to compile an old project that was originally designed for Visual Studio
While trying to compile my project, that uses some third party headers, with mingw
I'm trying to compile a little project that includes windows.h using the clang compiler.
I am trying to compile old iPhone application project using new LLVM 3.0 compiler.
I'm trying to compile an old project that I changed the UI a bit,
I have a large project that uses the Qt framework and am trying to
I'm trying to compile an old project using VS express 2010 but I get
I'm trying to build/compile a old project using the original makefile. When I do
Lately, I have been trying to compile php on my old PPC mac running

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.