microsoft / cpprestsdk

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
7.96k stars 1.65k forks source link

inaccessible member function ON G++ #1671

Open stpetrus27 opened 2 years ago

stpetrus27 commented 2 years ago

Thank you so much for this nice code. By the way, When I compile this on Linux(GCC) there are some errors accessing the protected member function. But, On Windows(VC++) it works fine.

Here is the error description.

function "web::json::details::_Value::format" (declared at line 1423 of "......json.h") is inaccessible C/C++(265)

‘virtual void web::json::details::_Value::format(std::__cxx11::basic_string&) const’ is protected within this context gcc

json_serialization.cpp: In member function ‘void web::json::value::format(std::__cxx11::basic_string&) const’: json_serialization.cpp:56:87: error: ‘virtual void web::json::details::_Value::format(std::__cxx11::basic_string&) const’ is protected within this context void web::json::value::format(std::basic_string& string) const { m_value->format(string); }

In file included from json_serialization.cpp:14: /json.h: note: declared protected here virtual void format(std::basic_string& stream) const { stream.append("null"); }

So, When modify the member function to Public, no error occurs.