Ask Your Question

Revision history [back]

Compilation error (VS 2008, 64 bit, Windows 7)

Hi all,

I have successfully compiled OpenCV 2.4.4 for 64-bits using Visual Studio 2008 on Windows 7 x64.

When I create sample application now, I get compilation errors in one of the OpenCV header files:

\modules\core\include\opencv2/core/operations.hpp(1456) : error C2065: 'val' : undeclared identifier

The following is relevant piece of the code, where 'val' is claimed to be undeclared.

template<> inline Vec<float, 3> Vec<float, 3>::cross(const Vec<float, 3>& v) const
{
    return Vec<float,3>(val[1]*v.val[2] - val[2]*v.val[1],
                     val[2]*v.val[0] - val[0]*v.val[2],
                     val[0]*v.val[1] - val[1]*v.val[0]);
}

template<> inline Vec<double, 3> Vec<double, 3>::cross(const Vec<double, 3>& v) const
{
    return Vec<double,3>(val[1]*v.val[2] - val[2]*v.val[1],
                     val[2]*v.val[0] - val[0]*v.val[2],
                     val[0]*v.val[1] - val[1]*v.val[0]);
}

I do see 'val' in the base class of Vec, Matx, so not sure why is this error coming. Possibly some issue with template specialization?

If I comment out the code in the above two functions, compilation succeeds.

Please help!

Thanks and best regards,

Alok