boostorg / system

Boost.org system module
http://boost.org/libs/system
36 stars 85 forks source link

make_error_code is undeclared? #114

Closed shrinktofit closed 11 months ago

shrinktofit commented 11 months ago

My compiler(Visual Studio 2022) said the make_error_code is undeclared here:

https://github.com/boostorg/system/blob/b0ef682e3d94f98478c00513ea7819f384a36f83/include/boost/system/detail/error_code.hpp#L142-L151

I searched for this symbol, I saw it's defined in: boost::system::errc and boost::system::windows_error etc. It certainly cannot be found within boost::system namespace(L150).

pdimov commented 11 months ago

What program are you trying to compile?

shrinktofit commented 11 months ago

I'm writing a program involving boost.beast, the boost.beast is referring to boost.system via:

image

and then the above error is given:

out\build\x64-debug\vcpkg_installed\x64-windows\include\boost\system\detail\error_code.hpp(150): error C3861: “make_error_code”: Could not find the identifier.

My IDE is Visual Studio 2022, C++ standard is configured as C++20 and I'm using C++ modules.

pdimov commented 11 months ago

The make_error_code overloads for boost::asio::error are here: https://github.com/boostorg/asio/blob/28ff1e7c2b44f141eb809abaf2d76c95f38350ca/include/boost/asio/error.hpp#L334-L356

make_error_code(e) should find them via argument-dependent lookup.

pdimov commented 11 months ago

E.g. https://godbolt.org/z/xco7hY5PP

shrinktofit commented 11 months ago

Thank you @pdimov . I must have encountered some language specific problem. Let me digit into it. :)