Skip to content

OpenCV fails to build with MinGW on Windows #17207

@hn-88

Description

@hn-88
System information (version)
  • OpenCV => 3.4.9
  • Operating System / Platform => Windows 64 Bit (appveyor build image)
  • Compiler => MinGW (32 bit)
Detailed description

MinGW build fails with the error message
videoInput::getMediaSubtypeAsString(GUID, char*)':
C:\projects\ocvwarp\opencv-3.4.9\modules\videoio\src\cap_dshow.cpp:2298:41: error: 'sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA' was not declared in this scope
if( type == MEDIASUBTYPE_RGB24) sprintf(tmpStr, "RGB24");
^
Can be seen at
https://ci.appveyor.com/project/hn-88/ocvwarp/builds/32524405

Steps to reproduce

Can fork my project at commit id 9e370bc2 and do an appveyor build
https://github.com/hn-88/OCVWarp/tree/9e370bc2d6d86838668dd975b825da487ccf51c6

Issue submission checklist
  • [. ] I report the issue, it's not a question
  • [. ] I checked the problem with documentation, FAQ, open issues,
    answers.opencv.org, Stack Overflow, etc and have not found solution
  • [. ] I updated to latest OpenCV version and the issue is still there
  • [ .] There is reproducer code and related data files: videos, images, onnx, etc

Can be solved by just adding a line to modules\videoio\src\cap_dshow.cpp

#define NO_DSHOW_STRSAFE

just above

#include "DShow.h"

I will submit this as a pull request.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions