2012-08-15 51 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

相关问题