2012-08-15 48 views
2

我正在使用OpenCV庫編碼計算機視覺程序。在我的程序中,我用「Vec3d」「typedef」類型稱爲「CLabPixelType」,它表示Lab色彩空間中的彩色像素。但是,當我使用XCode 4.4.1在Mac OS X Mountain Lion下編譯代碼時遇到以下問題。「xxx在OpenCV程序中未命名類型」錯誤

g++ ${CXXFLAGS} main.cpp slic.cpp slic_contrast.cpp -o sclbp -I/opt/local/include 
-L/opt/local/lib -lopencv_core.2.4.2 -lopencv_imgproc.2.4.2 -lopencv_highgui.2.4.2 

In file included from /usr/include/c++/4.2.1/backward/map.h:59, 
      from lxp_factory.h:8, 
      from cmd_parser.h:4, 
      from main.cpp:2: 
/usr/include/c++/4.2.1/backward/backward_warning.h:32:2: warning: #warning This 
file includes at least one deprecated or antiquated header. Please consider using 
one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples 
include substituting the <X> header for the <X.h> header for C++ includes, or 
<iostream> instead of the deprecated header  >>><iostream.h>. To disable this 
warning use -Wno-deprecated. 

In file included from lxp_framework.h:5, 
      from lxp_factory.h:5, 
      from cmd_parser.h:4, 
      from main.cpp:2: 
img_interpolater.h:10: error: ‘Vec3d’ does not name a type 
img_interpolater.h:45: error: ‘CLabPixelType’ does not name a type 
img_interpolater.h:97: error: ‘CLabPixelType’ does not name a type 

我不知道爲什麼會出現「‘Vec3d’沒有指定類型?我查了一下這樣的其他問題‘在#2 XX沒有指定類型’的錯誤,但未能找到答案。

回答

2

這是前陣子當我用OpenCV庫最後一次,但我認爲這個問題可能是你不考慮namespace cv

嘗試增加using namespace cv,或using namespace cv::CLabPixelType或者只是充分每個限定名稱時間你使用它像typedef cv::CLabPixelType Vec3d

+0

是的,它的工作原理,謝謝! – 2012-08-15 02:25:28

+0

我很高興幫助:) – 2012-08-15 02:29:55

相關問題