drogonframework / drogon

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

simple_reverse_proxy build error #1844

Open nobody93 opened 1 year ago

nobody93 commented 1 year ago

I added simple_reverse_proxy to CMakeLists.txt, but it got following building error:

drogon/examples/simple_reverse_proxy/plugins/SimpleReverseProxy.cc:42:60: error: unused parameter ‘ioLoopIndex’ [-Werror=unused-parameter] 42 [this](std::vector &clients, size_t ioLoopIndex) {

Branch: master Build host: ubuntu 20.04

What could I be missing?

thank you

rbugajewski commented 1 year ago

Unfortunately I don’t have the time to investigate this issue further, but it looks like some recent changes were introduced that make the compiler more aggressive as I get similar errors about unused values on macOS Monterey with Trantor:

/tmp/drogon-20231110-7398-qzdq7n/trantor/trantor/utils/Logger.cc:396:5: error: expression result unused [-Werror,-Wunused-value]
    (bool)logger;
    ^     ~~~~~~
1 error generated.
rbugajewski commented 1 year ago

PR #1839 may be the culprit.

nobody93 commented 1 year ago

Fixed it. @An Tao, I presume you did not intend to assign the ioLoopIndex in that lambda call, remove the ioLoopIndex fixed the build. In general for similar errors, if a variable is not used, to remove it should fix the build. Thank you