Name conflicts with CriticalSection

Posted on 2004-11-19
Last Modified: 2008-01-09
When I include the ATL support to my existing (C++ Win32) application I will get this compiler error:

error C2872: 'CCriticalSection' : ambiguous symbol
        could be 'c:\Program\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxmt.h(152) : CCriticalSection'
        or       'c:\Program\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsync.h(27) : ATL::CCriticalSection'

The framework include ATL to support Web Service call.

Running: VC7 C++
Platform: Windows XP SP2 / Server 2003
Question by:TYB
    LVL 5

    Expert Comment

    Hi TYB,

    Try "using namespace ATL;"

    Author Comment

    Can't affect the ATL call.

    The framework is making this when creating the stub code to access the web service.
    LVL 39

    Accepted Solution

    Analyze both header files. The class declaration of CCriticalSection should be protected by a macro at least by one of these ATL headers. Most likely you have to change the order of your includes somehow to get it compiled.

    Regards, Alex

    Author Comment

    Tnx a lot for the answer itsmeandnobodyelse.... it helped us out.

    Now we can compile the application successfully ..and it´s working properly too : )

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
    Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
    The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
    The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now