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

Unable to build client example. #1784

Closed albaropereyra22 closed 1 year ago

albaropereyra22 commented 1 year ago

Describe the bug Unable to build client example. I get the following error.

Severity Code Description Project File Line Suppression State Error C2039 'setSockOptCallback': is not a member of 'drogon::HttpClient' client_example C:\Users\dell\client_example\main.cc 20

To Reproduce Steps to reproduce the behavior: drogon_ctl create project client_example. copy client_example code. cd build cmake .. open sln file in visual studio, select release under build select rebuild.

Expected behavior Run client example.

Screenshots image

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

albaropereyra22 commented 1 year ago

Here is a link to the project: https://github.com/albaropereyra22/client_example

VladlenPopolitov commented 1 year ago

Just interesting - if you point to HttpClient and goto definition (not declaration) - you will find this method in the class defintion or VS shows other file? File has definition on line 166 in my version :

 /// Set socket options(before connecting)
    /**
     * @brief Set the callback which is called before connecting to the
     * server. The callback is used to set socket options on the socket fd.
     *
     * @code
       auto client = HttpClient::newHttpClient("http://www.baidu.com");
       client->setSockOptCallback([](int fd) {});
       auto req = HttpRequest::newHttpRequest();
       client->sendRequest(req, [](ReqResult result, const HttpResponsePtr&
       response) {});
       @endcode
     */
    virtual void setSockOptCallback(std::function<void(int)> cb) = 0;
albaropereyra22 commented 1 year ago

Here are my options thus far: image

albaropereyra22 commented 1 year ago

I figured it out. I got rid of the code since it was for linux anyways. That seems to have resolved my issue.

Thanks.