Solved

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

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Login Script to Copy Folders 12 22
repeatSeparator  java  challenge 13 56
Folder Comparison 12 52
Generic progress indicator 6 110
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
This video discusses moving either the default database or any database to a new volume.

744 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

10 Experts available now in Live!

Get 1:1 Help Now