[opencv_contrib - opencv_datasets] Compiling errors on Windows (Bugfix #3951)
Description
The datasets module does not compile on Windows (using MinGW):
opencv_contrib\modules\datasets\src\util.cpp: In function 'void cv::datasets::createDirectory(const string&)':
opencv_contrib\modules\datasets\src\util.cpp:77:35: error: 'S_IRWXG' was not declared in this scope
mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
opencv_contrib\modules\datasets\src\util.cpp:77:45: error: 'S_IROTH' was not declared in this scope
mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
opencv_contrib\modules\datasets\src\util.cpp:77:55: error: 'S_IXOTH' was not declared in this scope
mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
opencv_contrib\modules\datasets\src\util.cpp: In function 'void cv::datasets::getDirList(const string&, std::vector<std::basic_string<char> >&)':
opencv_contrib\modules\datasets\src\util.cpp:87:55: error: 'alphasort' was not declared in this scope
int n = scandir(dirName.c_str(), &namelist, NULL, alphasort);
opencv_contrib\modules\datasets\src\util.cpp:87:64: error: 'scandir' was not declared in this scope
int n = scandir(dirName.c_str(), &namelist, NULL, alphasort);
Windows does not have the concept group and other permissions in its file system, hence, these macros are not defined. The problem could be solved be adding:
/* These aren't provided by either MingW or MSVC */
#if defined WIN32 || defined _WIN32#define S_IRGRP 0
#define S_IWGRP 0
#define S_IXGRP 0
#define S_IRWXG 0
#define S_IROTH 0
#define S_IWOTH 0
#define S_IXOTH 0
#define S_IRWXO 0#endif
Associated revisions
Merge pull request #3951 from kalistratovag:mjpeg_dec_uninitialized
History
Updated by Vadim Pisarevsky over 10 years ago
Even though the support for MinGW is not of high priority for us, the proposed change is easy to do. Dmitry, can you please fix the bug as suggested?
- Description changed from The datasets module does not compile on Windows (using MinGW): > opencv_c... to The datasets module does not compile on Windows (using MinGW): > opencv_co... More
- Assignee set to Dmitriy Anisimov
- Difficulty set to Easy
- Target version set to 3.0
- Category set to legacy, contrib