-2

ステレオビジョンのソースコードを使用していますが、エラーが発生します

1>  StereoMain.cpp
1>c:\opencv2.2\include\opencv2\highgui\highgui_c.h(171): error C2059: syntax error : 'constant'
1>c:\opencv2.2\include\opencv2\highgui\highgui_c.h(171): error C3805: 'constant': unexpected token, expected either '}' or a ','
1>  StereoGrabber.cpp
1>c:\opencv2.2\include\opencv2\flann\logger.h(66): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          e:\program files\microsoft visual studio 10.0\vc\include\stdio.h(234) : see declaration of 'fopen'
1>c:\opencv2.2\include\opencv2\highgui\highgui_c.h(171): error C2059: syntax error : 'constant'
1>c:\opencv2.2\include\opencv2\highgui\highgui_c.h(171): error C3805: 'constant': unexpected token, expected either '}' or a ','
1>  StereoFunctions.cpp
1>c:\opencv2.2\include\opencv2\flann\logger.h(66): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          e:\program files\microsoft visual studio 10.0\vc\include\stdio.h(234) : see declaration of 'fopen'
1>c:\opencv2.2\include\opencv2\highgui\highgui_c.h(171): error C2059: syntax error : 'constant'
1>c:\opencv2.2\include\opencv2\highgui\highgui_c.h(171): error C3805: 'constant': unexpected token, expected either '}' or a ','
1>c:\documents and settings\giga\desktop\vision\source 

ソースコード

CVAPI(int) cvCreateTrackbar2( const char* trackbar_name, const char* window_name,
                              int* value, int count, CvTrackbarCallback2 on_change,
                              void* userdata CV_DEFAULT(0));

/* retrieve or set trackbar position */
CVAPI(int) cvGetTrackbarPos( const char* trackbar_name, const char* window_name );
CVAPI(void) cvSetTrackbarPos( const char* trackbar_name, const char* window_name, int pos );

enum
{
    CV_EVENT_MOUSEMOVE      =0,
    CV_EVENT_LBUTTONDOWN    =1,
    CV_EVENT_RBUTTONDOWN    =2,
    CV_EVENT_MBUTTONDOWN    =3,
    CV_EVENT_LBUTTONUP      =4,
    CV_EVENT_RBUTTONUP      =5,
    CV_EVENT_MBUTTONUP      =6,
    CV_EVENT_LBUTTONDBLCLK  =7,
    CV_EVENT_RBUTTONDBLCLK  =8,
    CV_EVENT_MBUTTONDBLCLK  =9
};

enum
{
    CV_EVENT_FLAG_LBUTTON   =1,
    CV_EVENT_FLAG_RBUTTON   =2,
    CV_EVENT_FLAG_MBUTTON   =4,
    CV_EVENT_FLAG_CTRLKEY   =8,
    CV_EVENT_FLAG_SHIFTKEY  =16,
    CV_EVENT_FLAG_ALTKEY    =32
};

typedef void (CV_CDECL *CvMouseCallback )(int event, int x, int y, int flags, void* param);

/* assign callback for mouse events */
CVAPI(void) cvSetMouseCallback( const char* window_name, CvMouseCallback on_mouse,
                                void* param CV_DEFAULT(NULL));

ありがとう http://pastebin.com/dpbCxLgK

4

1 に答える 1

12

あなたの列挙型の1つが以前にどこかで定義されていると思います。たとえば、次のコードスニペットは、VC++2010のエラーメッセージを複製します。

 #define CV_GUI_NORMAL 0x00000010

 enum
 {
    CV_GUI_EXPANDED   = 0x00000000,
    CV_GUI_NORMAL     = 0x00000010
 };

解決策は、明らかにCV_GUI_NORMALを1回だけ定義することです。

于 2012-04-17T12:27:16.073 に答える