c++windowsvisual-studioincludeambiguous

What causes "C2872 'ACCESS_MASK': ambiguous symbol"?


I am having an error with my Visual Studio 2015 C++ project that occurs 39 times, which states:

C2872 'ACCESS_MASK': ambiguous symbol

My issue is that the 'files' in which these are occurring are all Windows files, such as:

winnt.h

winuser.h

winreg.h

The include section of one of the projects .h file is as follows:

#pragma once;
#include <opencv/cv.h>
#include <opencv/cxcore.h>
#include <opencv/highgui.h>
#include <opencv/cvaux.h>//Background modeling header files

#include "opencv2/imgcodecs.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/videoio.hpp"
#include <opencv2/highgui.hpp>
#include <opencv2/video.hpp>
#include <windef.h>
using namespace cv; 

and the other .h file has the following includes:

#include <opencv2/opencv.hpp>
#include <XnCppWrapper.h>//OpenNI
using namespace cv;  

#include <iostream>  
#include <stdlib.h>
using namespace std ; 

Is there perhaps an error due to having "using namespace ..." more than once?

The only other error that I am encountering is also from the winnt.h file, I am not sure if it is related but have included it just in case, and it is as follows :

C1189 #error: "No Target Architecture"

I have tried changing around the included Windows files, as well as the using namespace cv, as some others have suggested, but have had no success.


Solution

  • Issue solved by removing all cases where :

    using namespace cv

    appeared. I did however have to add 'cv::' infront of all opencv related functions that had appeared in the code using the cv namespace.

    The C1189 error was unrelated to this.