Compilation error of `Log.cpp` on Windows
pattacini opened this issue · comments
Describe the bug
Got compilation error con icub-main
CI of yarp-3.8
at:
yarp/src/libYARP_os/src/yarp/os/Log.cpp
Line 751 in 323e27a
Here's the error:
2023-10-19T08:04:46.9034651Z D:\a\icub-main\icub-main\yarp\src\libYARP_os\src\yarp\os\Log.cpp(751,27): error C2589: '(': illegal token on right side of '::' [D:\a\icub-main\icub-main\yarp\build\src\libYARP_os\src\YARP_os.vcxproj]
2023-10-19T08:04:46.9120915Z D:\a\icub-main\icub-main\yarp\src\libYARP_os\src\yarp\os\Log.cpp(751,27): error C2062: type 'unknown-type' unexpected [D:\a\icub-main\icub-main\yarp\build\src\libYARP_os\src\YARP_os.vcxproj]
2023-10-19T08:04:46.9123747Z D:\a\icub-main\icub-main\yarp\src\libYARP_os\src\yarp\os\Log.cpp(751,27): error C2059: syntax error: ')' [D:\a\icub-main\icub-main\yarp\build\src\libYARP_os\src\YARP_os.vcxproj]
2023-10-19T08:04:46.9324216Z D:\a\icub-main\icub-main\yarp\src\libYARP_os\src\yarp\os\Log.cpp(752): error C3536: 'p': cannot be used before it is initialized [D:\a\icub-main\icub-main\yarp\build\src\libYARP_os\src\YARP_os.vcxproj]
To Reproduce
Steps to reproduce the behavior:
See:
Expected behavior
We should fix yarp-3.8
in this respect.
Screenshots
If applicable, add screenshots to help explain your problem.
Configuration (please complete the following information):
- OS:
- yarp version: 3.8
- compiler:
The build environment can be figured out from the GH CI.
Additional context
Add any other context about the problem here.
cc @randaz81
I got the same problem in the robotology-superbuild: robotology/robotology-superbuild#1505 . I guess it is a regression due to an update in Visual Studio version in GitHub Actions. I suspect some header started including windows.h
, and so we have a problem with the min
macro definition. Probably we can define somewhere (even at CMake level) NOMINMAX
(see https://stackoverflow.com/questions/13416418/define-nominmax-using-stdmin-max). Another workaround is to write std::min
as (std::min)
, see https://stackoverflow.com/questions/13416418/define-nominmax-using-stdmin-max .
Actually windows.h is explicitly included, see
yarp/src/libYARP_os/src/yarp/os/Log.cpp
Line 45 in a0d408b
YARP_HAS_WIN_VT_SUPPORT
defined, see yarp/cmake/YarpSystemCheck.cmake
Line 175 in a0d408b
CMAKE_SYSTEM_VERSION
is a tricky variable and can change based on the Windows SDK installed in the machine or the CMake version. Anyhow, I think regardless of what happened this needs to be fixed.Interesting, NOMINMAX
should be already defined, see
yarp/src/libYARP_os/src/CMakeLists.txt
Line 438 in a0d408b
YARP_HAS_WIN_VT_SUPPORT
part of the code.Any news about this?
It's somewhat critical as it breaks our main CI workflows in robotology-superbuild, icub-main...
Thanks @randaz81 !