Solved

How do I define which namespace compiler should use in MFC?

Posted on 2007-11-14
3
960 Views
Last Modified: 2013-11-20
My MFC project includes several modules and now I introduced another with access to WebServices. Since then I get the compiler error:
error C2872: 'CMutex' : ambiguous symbol
        could be 'c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxmt.h(105) : CMutex'
        or 'c:\program files\microsoft visual studio 8\vc\atlmfc\include\atlsync.h(77) : ATL::CMutex'
Obviously both files have CMutex class defined and it is not the same. If ATL versiun would be the one this module needs, I could probably define the namespace with ATL::CMutex. But how can I tell the compiler that it should take the first version? It has no namespace specified!?
0
Comment
Question by:igams
3 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20283711
MFC classes don't belong to a namespace.
Do you have to use both ATL and MFC in the same application?
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 20283946
You could use

::CMutex myMutex;
0
 

Author Closing Comment

by:igams
ID: 31409225
Simple solutions are always the best! I should have thought of it myself! :-)
But then I got confused with namespaces...
Thanks a lot!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

773 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