Compilation error (VS 2008, 64 bit, Windows 7) [closed]
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
are you using precompiled headers ?
@berak, I am not using pre-compiled headers. The Visual Studio solution is generated using Cmake. After struggling with this a bit, I find that the code compiles correctly if I prepare VS project by hand. Something is wrong in the Cmake files. It is discovering OpenCV includes and libs by itself, but maybe not from the correct place.
Getting to the bottom of the issue, this compilation error happens with Microsoft-specific language extensions are "disabled". This is compiler flag "/Za". Using this option is normally good to ensure the code will compile across platforms (since Microsoft-specific extensions are not available outside of Windows), but somehow there is some issue with OpenCV code even though it is cross-platform.
Hello Alok, Could you please help me with OpenCV installation? I have Windows 7, 64-bit. I am finding it difficult to install it. I have VS 2008 (i don't know if its for 32-bit/64-bit) and which version of OpenCV should i install? Could you please explain.....I want to learn lot of things but this installation is troubling a lot! thanks n best regards, shekhar
@shekar, since your problem might be total different from this one, please dare to start a new question !