Ask Your Question

Errors building OpenCV-2.4.6 with Visual Studio 2013

asked 2013-08-15 23:10:59 -0500

naraku9333 gravatar image

updated 2013-08-17 03:34:11 -0500

I am attempting to build OpenCV with VC12 and have encountered an error I can't figure out. Here is the error

opencv\modules\core\include\opencv2/core.hpp(1136): fatal error C1075: end of file found before the left brace '{' at '......\modules\features2d\src\features2d_init.cpp(182)' was matched

Snip from core.hpp

  template<typename _Tp> void addParam(Algorithm& algo, const char* name,
              Ptr<_Tp>& value, bool readOnly=false,
              Ptr<_Tp> (Algorithm::*getter)()=0,
              void (Algorithm::*setter)(const Ptr<_Tp>&)=0,//LINE 1136
              const String& help=String());

Snip from features2d_init.cpp

CV_INIT_ALGORITHM(GridAdaptedFeatureDetector, "Feature2D.Grid",
    >addParam(obj, "detector", obj.detector);
    >addParam(obj, "maxTotalKeypoints", obj.maxTotalKeypoints);
    >addParam(obj, "gridRows", obj.gridRows);
    >addParam(obj, "gridCols", obj.gridCols));//LINE 182

And here is the macro definition from private.hpp

#define CV_INIT_ALGORITHM(classname, algname, memberinit) \
static ::cv::Algorithm* create##classname##_hidden() \
{ \
    return new classname; \
} \
static ::cv::AlgorithmInfo& classname##_info() \
{ \
    static ::cv::AlgorithmInfo classname##_info_var(algname, create##classname##_hidden); \
    return classname##_info_var; \
} \
static ::cv::AlgorithmInfo& classname##_info_auto = classname##_info(); \
::cv::AlgorithmInfo* classname::info() const \
{ \
    static volatile bool initialized = false; \
    if( !initialized ) \
    { \
        initialized = true; \
        classname obj; \
        memberinit; \
    } \
    return &classname##_info(); \

Any help is appreciated.

edit retag flag offensive close merge delete


Hmm I know that vc10 is supported for VS2010 and vc11 for VS2013 but it seems that some building rules must have changed when switching to VS2013. However, you can still use vc11 or vc10 in VS2013 right? Why not do that to solve the problem?

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-17 03:37:09 -0500 )edit

I have the same issue as well. Seeing as VS2013 will shortly be widely adopted, we might a well figure out a solution now.

erickulcyk gravatar imageerickulcyk ( 2013-09-10 10:07:38 -0500 )edit

I have the same issue with VS2013. The error occurs with both OpenCV 2.4.6-stable and the git-master. The issue occurs in VS2013, but not in VS2012. How can we fix that for VS2013?

Elador gravatar imageElador ( 2013-09-12 17:02:25 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-10-20 10:36:17 -0500

Jose Luis Blanco gravatar image

updated 2013-11-04 14:18:46 -0500

This specific error can be fixed by changing that line to:>addParam<FeatureDetector>(obj, "detector", obj.detector, false, 0, 0, "Detector algorithm.");

But there're a few other errors (and nasty internal compiler errors!) that have to be handled while building OpenCV in MSVC 2013. I uploaded the list of corrections to this fork of OpenCV in GitHub. --> pull request

edit flag offensive delete link more



good start!

eventually make an issue and a pull-request

berak gravatar imageberak ( 2013-10-20 10:45:38 -0500 )edit

The link to your fork is not working. User jlblancoc doesn't exist. Can you please update?

Elador gravatar imageElador ( 2013-10-29 06:40:55 -0500 )edit

user exists, but the repo does not.

@Jose Luis Blanco, what happened ?

berak gravatar imageberak ( 2013-10-29 06:59:21 -0500 )edit

The changes were integrated into the main OpenCV repo via a pull-request, so I removed my fork. Here's the pull request:

Jose Luis Blanco gravatar imageJose Luis Blanco ( 2013-11-01 07:20:33 -0500 )edit

ah, ok. thanks for clarifying

berak gravatar imageberak ( 2013-11-01 07:23:25 -0500 )edit

Question Tools


Asked: 2013-08-15 23:10:59 -0500

Seen: 3,349 times

Last updated: Nov 04 '13