chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.97k stars 1.22k forks source link

unable to build under windows #1552

Closed marakew closed 3 weeks ago

marakew commented 3 weeks ago
In file included from D:\git\boost_\libs\asio\include\boost/asio/deadline_timer.hpp:26:
In file included from D:\git\boost_\libs\asio\include\boost/asio/basic_deadline_timer.hpp:27:
In file included from D:\git\boost_\libs\asio\include\boost/asio/detail/deadline_timer_service.hpp:32:
In file included from D:\git\boost_\libs\asio\include\boost/asio/detail/timer_scheduler.hpp:24:
In file included from D:\git\boost_\libs\asio\include\boost/asio/detail/win_iocp_io_context.hpp:335:
In file included from D:\git\boost_\libs\asio\include\boost/asio/detail/impl/win_iocp_io_context.hpp:22:
In file included from D:\git\boost_\libs\asio\include\boost/asio/detail/completion_handler.hpp:21:
In file included from D:\git\boost_\libs\asio\include\boost/asio/detail/handler_work.hpp:20:
In file included from D:\git\boost_\libs\asio\include\boost/asio/associated_executor.hpp:24:
In file included from D:\git\boost_\libs\asio\include\boost/asio/system_executor.hpp:671:
In file included from D:\git\boost_\libs\asio\include\boost/asio/impl/system_executor.hpp:21:
In file included from D:\git\boost_\libs\asio\include\boost/asio/system_context.hpp:19:
In file included from D:\git\boost_\libs\asio\include\boost/asio/detail/scheduler.hpp:236:
In file included from D:\git\boost_\libs\asio\include\boost/asio/detail/impl/scheduler.ipp:20:
In file included from D:\git\boost_\libs\asio\include\boost/asio/config.hpp:190:
D:\git\boost_\libs\asio\include\boost/asio/impl/config.hpp(54,52): error: too few arguments provided to funct
ion-like macro invocation
   54 |           || result > (std::numeric_limits<T>::max()))
      |                                                    ^
D:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared\minwindef.h(193,9): note: macro 'max' defined
here
  193 | #define max(a,b)            (((a) > (b)) ? (a) : (b))
      |         ^

pls add

undef max

for config.hpp

mabrarov commented 3 weeks ago

Hi,

IMHO, this issue is usually solved by usage of brackets, i.e. by replacing

|| result > (std::numeric_limits<T>::max()))

with

|| result > (std::numeric_limits<T>::max)())

but not with preprocessor directive.

Comparing https://github.com/chriskohlhoff/asio/blob/master/asio/include/asio/impl/config.hpp#L52 with lines:

  1. https://github.com/chriskohlhoff/asio/blob/master/asio/include/asio/impl/config.hpp#L40
  2. https://github.com/chriskohlhoff/asio/blob/master/asio/include/asio/impl/config.hpp#L53

it looks like the last two require fix (it looks like somebody tried to apply the same fix there, but made a typo).

Thank you.