Ask Your Question
3

Not able to build OpenCV3-RC1 with 'Debug' build type

asked May 25 '15

Vaniax gravatar image

updated May 26 '15

berak gravatar image

Hi,

I have problems to build OpenCV3-RC1 with the Debug build type activated. I was able to build a normal shared library version, but with debug mode I get the following:

error: 'sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA' was not declared in this scope

My compiler is 'mingw-w64 4.9.2 posix sjlj'.

Extract from the log:

    [  2%] [  9%] Built target zlib
Built target libjpeg
[ 18%] [ 23%] Built target libwebp
Built target libjasper
[ 23%] Built target opencv_ts_pch_dephelp
[ 26%] [ 32%] Built target libpng
[ 42%] Built target libtiff
Built target IlmImf
[ 42%] Built target pch_Generate_opencv_ts
[ 42%] Building CXX object modules/world/CMakeFiles/opencv_world.dir/__/videoio/src/cap_dshow.cpp.obj
[ 42%] [ 43%] Building CXX object modules/world/CMakeFiles/opencv_world.dir/__/features2d/src/dynamic.cpp.obj
Building CXX object modules/world/CMakeFiles/opencv_world.dir/__/features2d/src/evaluation.cpp.obj
[ 43%] Building CXX object modules/world/CMakeFiles/opencv_world.dir/__/features2d/src/fast.cpp.obj
[ 43%] Building CXX object modules/world/CMakeFiles/opencv_world.dir/__/features2d/src/fast_score.cpp.obj
In file included from D:\Programmierung\Bibliotheken\OpenCV\3.0.0-rc1\opencv\sources\modules\videoio\src\cap_dshow.cpp:332:0:
D:\Programmierung\Bibliotheken\OpenCV\3.0.0-rc1\opencv\sources\modules\videoio\src\cap_dshow.cpp: In member function 'void videoInput::getMediaSubtypeAsString(GUID, char*)':
D:\Programmierung\Bibliotheken\OpenCV\3.0.0-rc1\opencv\sources\modules\videoio\src\cap_dshow.cpp:2178:41: error: 'sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA' was not declared in this scope
     if( type == MEDIASUBTYPE_RGB24)     sprintf(tmpStr, "RGB24");
                                         ^
D:\Programmierung\Bibliotheken\OpenCV\3.0.0-rc1\opencv\sources\modules\videoio\src\cap_dshow.cpp:2178:57: warning: left operand of comma operator has no effect [-Wunused-value]
     if( type == MEDIASUBTYPE_RGB24)     sprintf(tmpStr, "RGB24");
                                                         ^
D:\Programmierung\Bibliotheken\OpenCV\3.0.0-rc1\opencv\sources\modules\videoio\src\cap_dshow.cpp:2179:5: error: 'else' without a previous 'if'
     else if(type == MEDIASUBTYPE_RGB32) sprintf(tmpStr, "RGB32");
     ^
In file included from D:\Programmierung\Bibliotheken\OpenCV\3.0.0-rc1\opencv\sources\modules\videoio\src\cap_dshow.cpp:332:0:
D:\Programmierung\Bibliotheken\OpenCV\3.0.0-rc1\opencv\sources\modules\videoio\src\cap_dshow.cpp:2179:41: error: 'sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA' was not declared in this scope
     else if(type == MEDIASUBTYPE_RGB32) sprintf(tmpStr, "RGB32");
                                         ^
D:\Programmierung\Bibliotheken\OpenCV\3.0.0-rc1\opencv\sources\modules\videoio\src\cap_dshow.cpp:2179:57: warning: left operand of comma operator has no effect [-Wunused-value]
     else if(type == MEDIASUBTYPE_RGB32) sprintf(tmpStr, "RGB32");
                                                         ^
D:\Programmierung\Bibliotheken\OpenCV\3.0.0-rc1\opencv\sources\modules\videoio\src\cap_dshow.cpp:2180:5: error: 'else' without a previous 'if'
     else if(type == MEDIASUBTYPE_RGB555)sprintf(tmpStr, "RGB555");
     ^
In file included from D:\Programmierung\Bibliotheken\OpenCV\3.0.0-rc1\opencv\sources\modules\videoio\src\cap_dshow.cpp:332:0:
D:\Programmierung\Bibliotheken\OpenCV\3.0.0-rc1\opencv\sources\modules\videoio\src\cap_dshow.cpp:2180:41: error: 'sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA' was not declared in this scope
     else if(type == MEDIASUBTYPE_RGB555)sprintf(tmpStr, "RGB555");
                                         ^
D:\Programmierung\Bibliotheken\OpenCV\3.0.0-rc1\opencv\sources\modules\videoio\src\cap_dshow.cpp:2180:57: warning: left operand of comma operator has no effect [-Wunused-value]
     else if(type == MEDIASUBTYPE_RGB555)sprintf(tmpStr, "RGB555");
                                                         ^
D:\Programmierung\Bibliotheken\OpenCV\3.0.0-rc1 ...
(more)
Preview: (hide)

Comments

Yes i have the same problem with OpenCV-3.0.0

My compiler is 'x86_64-5.1.0-release-win32-seh-rt_v4-rev0'. (mingw-builds 64 bits gcc 5.1.0 win32 seh) [Windows 8.1]

DJuego

DJUego gravatar imageDJUego (Jun 10 '15)edit

2 answers

Sort by » oldest newest most voted
4

answered Aug 25 '15

chinadragon0515 gravatar image

I met the same issue with opencv3.0.0 to be built with mingw, and I have workaround this, the way I worked around is,

edit file %OPENCV_HOME%\sources\modules\videoio\src\cap_dshow.cpp Add

#define STRSAFE_NO_DEPRECATE

At least, it works for me and pass the error.

Preview: (hide)

Comments

I have the same problem. adding your(chinadragon) piece of code did not help. Any other suggestions ?

acevans gravatar imageacevans (Jan 4 '16)edit

Actually it did help. But I get other warnings now.

c:\mingw\include\strsafe.h:987:10: error: 'dwFlags' was not declared in this scope

acevans gravatar imageacevans (Jan 4 '16)edit

This fix worked for me too. Qt 5.6, mingw 4.92, windows 7 64 bit, opencv 3.1, debug build

lama123 gravatar imagelama123 (May 18 '16)edit

It works for me too! thanks a lot!

Josmomoy gravatar imageJosmomoy (Aug 29 '17)edit
0

answered Jan 30 '19

adding -DHAVE_DSHOW=0 seemed another option. No idea why I get this cross compiling from OS X but not linux, for windows. weird. ref.

https://github.com/aleksey-nikolaev/O...

Preview: (hide)

Question Tools

1 follower

Stats

Asked: May 25 '15

Seen: 6,801 times

Last updated: Jan 29 '19