I am coding an computer vision program using OpenCV library. In my program, I “typedef” a type called “CLabPixelType” by “Vec3d”, which is to represent a color pixel in Lab color space. However, I encounter the following problem when I compile the code by g++ under Mac OS X Mountain Lion with 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
I do not know why it shows “‘Vec3d’ does not name a type? I checked the other questions about such “XX does not name a type” error in Stackoverflow but failed to find an answer.
It is a while back when I used opencv library the last time, but I think the problem may be that you don’t take into account namespace cv
Try adding
using namespace cv, orusing namespace cv::CLabPixelTypeor just qualify the name fully each time you use it liketypedef cv::CLabPixelType Vec3d.