Compilation failure in VS2010 (Error C2891)

asked 2013-03-08 13:28:09 -0500

Hey all,

I'm trying to build a simple OpenCV (v2.4.4) program with Visual Studio 2010 and encountering an issue that I've never seen with OpenCV under linux. I suspect it's a MS vs gcc thing, but here's the error I get (keep in mind this worked fine before under linux - only the compiler is different):

C:\Program Files\opencv\build\include\opencv2/core/core.hpp(3142): error C2891: 'fixed_size' : cannot take the address of a template parameter

C:\Program Files\opencv\build\include\opencv2/core/core.hpp(3114) : see declaration of 'fixed_size'

C:\Program Files\opencv\build\include\opencv2/core/core.hpp(3143) : see reference to class template instantiation 'cv::AutoBuffer<_Tp,fixed_size>' being compiled

I'm a stranger in a strange Windows land, so any advice is appreciated. I may try reverting to a 2.3.x version of OpenCV, but I had some dim hope that there was an easy fix and I was just missing something obvious; C++ template programming isn't my favorite thing.

Thanks in advance,

Bill U

edit retag flag offensive close merge delete



your errors don't make any sense without the code, that caused them.

so please show the offending code.

berak gravatar imageberak ( 2013-03-08 13:33:33 -0500 )edit

I agree that they don't make any sense, but the only offending line of code is

#include &lt;core/core.hpp&gt;

As far as I can tell, it never gets past parsing the OpenCV header file 'core.hpp', failing with the error noted above (C2891). I'll post if I can track down a solution.

FWIW: VS 2010, Win7 64 bit, pre-built binaries for OpenCV



ckbehemoth gravatar imageckbehemoth ( 2013-03-11 11:40:15 -0500 )edit

if something like

  #include "opencv2/core/core.hpp"

  int main() 
  { return 0; }

crashes, then it's time for a bugreport!

berak gravatar imageberak ( 2013-03-11 13:09:52 -0500 )edit

OK - FWIW I got it working. I was bringing over some Qt code and there were some header files included in the chain. Turns out, by changing the order of inclusion, it compiles fine, e.g. OpenCV then Qt is fine, but Qt then OpenCV gave me the above error. Some clobbering of 'size_t'?

Sorry for any confusion - I never suspected this, since the exact same code worked fine on Linux, OSX, and Windows with mingw. Just under VS did this pop up. Sigh.

ckbehemoth gravatar imageckbehemoth ( 2013-03-14 12:16:32 -0500 )edit

oh dear ;)

berak gravatar imageberak ( 2013-03-14 12:38:24 -0500 )edit