Solved

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

Posted on 2007-11-14
3
979 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C++ BOOL WINAPI ReadFile fails on windows 10 when reading from USB cable 9 476
sumDigits challenge 9 170
Modbus - whats the maximum I can store in one register? 4 80
Not needed 13 120
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

807 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