Ask Your Question
3

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

asked 2015-05-25 16:27:27 -0600

Vaniax gravatar image

updated 2015-05-26 02:30:58 -0600

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)
edit retag flag offensive close merge delete

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 ( 2015-06-10 08:11:18 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
4

answered 2015-08-25 07:50:31 -0600

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.

edit flag offensive delete link more

Comments

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

acevans gravatar imageacevans ( 2016-01-04 05:14:28 -0600 )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 ( 2016-01-04 05:23:02 -0600 )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 ( 2016-05-18 04:06:03 -0600 )edit

It works for me too! thanks a lot!

Josmomoy gravatar imageJosmomoy ( 2017-08-29 13:13:03 -0600 )edit
0

answered 2019-01-29 21:33:49 -0600

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...

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-05-25 16:27:27 -0600

Seen: 6,670 times

Last updated: Jan 29 '19