Skip to content

core\eigen.hpp fails to first check for NOMINMAX definition, causes compile fail #21604

@diablodale

Description

@diablodale

core\eigen.hpp is missing #ifndef check before forcing #define NOMINMAX.
Causes compile fails on MSVC with flags for high standards.

#if defined _MSC_VER && _MSC_VER >= 1200
#define NOMINMAX // fix https://github.com/opencv/opencv/issues/17548
#pragma warning( disable: 4714 ) //__forceinline is not inlined

The bug was introduced by #17578 as attempt to fix #17548

[build] [26/28  57% :: 23.268] C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe  ...
[build] FAILED: CMakeFiles/......obj 
[build] Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30140 for x64
[build] Copyright (C) Microsoft Corporation.  All rights reserved.
[build] C:\...\Release\include\opencv2/core/eigen.hpp(55): error C2220: the following warning is treated as an error
[build] C:\...\Release\include\opencv2/core/eigen.hpp(55): warning C4005: 'NOMINMAX': macro redefinition
[build] command line(1): note: see previous definition of 'NOMINMAX'
...
[build] ninja: build stopped: subcommand failed.
[build] Build finished with exit code 1
System information (version)
  • OpenCV => 4.5.4, 4.5.5, and further
  • Operating System / Platform => all, but this surfaces most easily in MSVC
  • Compiler => MSVC
Detailed description

As above. Missing #ifndef surrounding the #define

Steps to reproduce

Review the code.

Fix

trivial

#ifndef NOMINMAX
#define NOMINMAX // fix https://github.com/opencv/opencv/issues/17548
#endif
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions