2

我正在使用 OpenCV 库编写计算机视觉程序。在我的程序中,我通过“Vec3d”“typedef”了一个名为“CLabPixelType”的类型,用于表示Lab颜色空间中的一个颜色像素。但是,当我在 Mac OS X Mountain Lion 下使用 XCode 4.4.1 编译代码时遇到以下问题。

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'没有命名类型?我在Stackoverflow中检查了关于此类“XX没有命名类型”错误的其他问题,但未能找到答案。

4

1 回答 1

2

我上次使用 opencv 库时已经有一段时间了,但我认为问题可能是您没有考虑命名空间 cv

尝试添加using namespace cvusing namespace cv::CLabPixelType或者只是在每次使用时完全限定名称typedef cv::CLabPixelType Vec3d

于 2012-08-15T02:16:42.510 回答