Skip to content

Building modbus on Windows 11Β #36

@AbdallaDalleh

Description

@AbdallaDalleh

Environment:
Windows 11
VS 2022 (latest)
MSVC 143 (latest)
EPICS Base 7.0.9
Modbus (latest)

We rarely build EPICS on Windows so I understand I might be missing something. I came up into building modbus and several other modules under Windows 11, everything built fine except modbus. I got compiler error C2589 on this line https://github.com/epics-modules/modbus/blob/master/modbusApp/src/drvModbusAsyn.cpp#L520 and several others, all the errors have to do with std::min. After research I came into this old thread https://stackoverflow.com/questions/5004858/why-is-stdmin-failing-when-windows-h-is-included and both these solutions work:

  1. Explicitly specify template data type, i.e. std::min<int>
  2. Use parenthesis (std::min) to prevent the MSVC preprocessor from using its own min macros.

Let me know if this is OK so I can submit a PR! πŸ‘

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions