我對'使用命名空間'聲明的範圍感到困惑......希望有人能爲我解決這個問題!對命名空間範圍感到困惑!
我使用兩個庫(OpenCV和Ogre3D)。我有兩個cpp文件,一個專門使用OpenCV(PoseEstimator.cpp),另一個專門使用Ogre3D(OgreLogic.cpp)。
OgreLogic.cpp的頂部看起來是這樣的:
#include "stdafx.h"
#include "PoseEstimator.h"
#include "OgreLogic.h"
using namespace Ogre;
而且PoseEstimator.cpp的頂部看起來是這樣的:
#include "StdAfx.h"
#include "PoseEstimator.h"
using namespace cv;
using namespace std;
這 '使用命名空間CV' 只是在整個項目中發生(我通過搜索進行雙重檢查)。沒有'在標題中使用命名空間,只有在cpp文件中。
然而,編譯OgreLogic.cpp當我得到模棱兩可的錯誤,如:
cxmat.hpp(3465):錯誤C2872: 'UCHAR' :曖昧的符號1>可能是 「D:\ libraries \ opencv2.1 \ include \ opencv \ cxtypes.h(154) :unsigned char uchar'1> or
'd:\ libraries \ ogresdk \ include \ ogre \ OgrePrerequisites.h(106) :Ogre :: uchar'
我好像誤會了什麼,因爲我認爲這應該是好的?
任何幫助非常感謝!
感謝,
傑克
謝謝你的幫助。 我通過將cxmat.hpp(openCV頭)中的uchar引用更改爲unsigned char來「解決」了問題。 似乎現在工作! – 2011-03-17 15:37:16
沒問題 - 它工作嗎? – spbots 2011-03-17 15:38:10
不小心發佈了,試圖按下輸入做一個新的行,但被抓出來! – 2011-03-17 15:41:59