gpt4 book ai didi

c++ - "xxx does not named a type"OpenCV程序错误

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:54:31 26 4
gpt4 key购买 nike

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

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

最佳答案

我上次使用opencv库是前一段时间了,但我认为问题可能是你没有考虑到namespace cv

尝试添加using namespace cv,或using namespace cv::CLabPixelType,或者每次使用时都完全限定名称,如typedef cv::CLabPixelType Vec3d.

关于c++ - "xxx does not named a type"OpenCV程序错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11963258/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com