libcpr / cpr

C++ Requests: Curl for People, a spiritual port of Python Requests.
https://docs.libcpr.org/
Other
6.29k stars 903 forks source link

Call of overloaded ‘SetOption(std::__cxx11::basic_string<char>)’ is ambiguous #1032

Closed glingi closed 3 months ago

glingi commented 3 months ago

Description

Build error

/usr/local/include/cpr/api.h:30:5: error: call of overloaded ‘SetOption(std::__cxx11::basic_string<char>)’ is ambiguous 30 | session.SetOption(std::forward<CurrentType>(current_option));

Example/How to Reproduce

1. Set CPR CMake configuration

CXX standard: 17 C++ Requests CMake Options CPR_GENERATE_COVERAGE: OFF CPR_CURL_NOSIGNAL: OFF CURL_VERBOSE_LOGGING: OFF CPR_USE_SYSTEM_GTEST: OFF CPR_USE_SYSTEM_CURL: OFF CPR_ENABLE_CURL_HTTP_ONLY: ON CPR_ENABLE_SSL: ON CPR_FORCE_OPENSSL_BACKEND: OFF CPR_FORCE_WINSSL_BACKEND: OFF CPR_FORCE_DARWINSSL_BACKEND: OFF CPR_FORCE_MBEDTLS_BACKEND: OFF CPR_ENABLE_LINTING: OFF CPR_ENABLE_CPPCHECK: OFF CPR_BUILD_TESTS: ON CPR_BUILD_TESTS_SSL: ON CPR_BUILD_TESTS_PROXY: OFF CPR_SKIP_CA_BUNDLE_SEARCH: OFF CPR_USE_BOOST_FILESYSTEM: OFF CPR_DEBUG_SANITIZER_FLAG_THREAD: OFF CPR_DEBUG_SANITIZER_FLAG_ADDR: OFF CPR_DEBUG_SANITIZER_FLAG_LEAK: OFF CPR_DEBUG_SANITIZER_FLAG_UB: OFF CPR_DEBUG_SANITIZER_FLAGALL: OFF Automatically detecting SSL backend. Detecting SSL backend... SSL auto detect: Using OpenSSL._ Configuring built-in curl... Enabled curl SSL curl version=[8.4.0] Picky compiler options: -W -Wall -pedantic -Wbad-function-cast -Wconversion -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-long-long -Wno-multichar -Wpointer-arith -Wshadow -Wsign-compare -Wundef -Wunused -Wwrite-strings -Wcast-align -Wdeclaration-after-statement -Wempty-body -Wendif-labels -Wfloat-equal -Wignored-qualifiers -Wno-format-nonliteral -Wno-sign-conversion -Wno-system-headers -Wstrict-prototypes -Wtype-limits -Wvla -Wmissing-parameter-type -Wold-style-declaration -Wstrict-aliasing=3 -Wformat=2 -Warray-bounds=2 -ftree-vrp -Wduplicated-cond -Wnull-dereference -fdelete-null-pointer-checks -Wshift-negative-value -Wshift-overflow=2 -Walloc-zero -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=1 -Wrestrict -Wdouble-promotion -Wunused-const-variable Could NOT find LibPSL (missing: LIBPSL_LIBRARY LIBPSL_INCLUDE_DIR) Could NOT find LibSSH2 (missing: LIBSSH2_LIBRARY LIBSSH2_INCLUDE_DIR) Enabled features: SSL IPv6 unixsockets libz AsynchDNS Largefile alt-svc HSTS NTLM TLS-SRP HTTPS-proxy threadsafe Enabled protocols: HTTP HTTPS Enabled SSL backends: OpenSSL Not using system gtest, using built-in googletest project instead. Building mongoose project for test support.

2. Build and Install CPR library

3. Build my project with CPR library

4. See error

Possible Fix

Disable OpenSSL

Where did you get it from?

GitHub (branch e.g. master)

Additional Context/Your Environment

glingi commented 3 months ago

It's my fault. I passed std::string get_url as argument for PostCallback.

cpr::PostCallback(callback, get_url, payload);