drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.44k stars 1.1k forks source link

gcc-6 compilation error #1372

Closed mnesytyh closed 1 year ago

mnesytyh commented 2 years ago

Hello. When trying to build a project, I get the following error: /root/drogon/lib/src/Cookie.cc:33:17: error: ‘const class boost::optional’ has no member named ‘hasvalue’; did you mean ‘value’? if (maxAge.has_value()) Based on the lib/inc/drogon/utils/optional.h, it turns out that if the compiler does not support C++17, then boost::optional is used. But there is actually no has_value() method, unlike std::optional. It turns out that the next branch will never work correctly:

#else
const boost::none_t null ptr = boost::none;
using boost::optional;

Do I understand correctly that at the moment the minimum requirements are support for C++17?

an-tao commented 2 years ago

Boost Release 1.68 Added member function has_value() for compatibility with std::optional (issue #52). Added member function map() for transforming optional into optional using a function of type T -> U. Added member function flat_map() for transforming optional into optional using a function of type T -> optonal.

you should upgrade your boost version to 1.68 or newer