eidheim / Simple-Web-Server

A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.
MIT License
2.61k stars 751 forks source link

Cannot compile on VS2013 which may not have full C++ 11 support #182

Open chenzx opened 6 years ago

chenzx commented 6 years ago

Here are compile errors:

Error 62 error C2227: left of '->content' must point to class/struct/union/generic type D:\repo\Simple-Web-Server\http_examples.cpp 223 1 http_examples

but the source code is in fact very simple:

  // Synchronous request examples
  try {
    auto r1 = client.request("GET", "/match/123");
    cout << r1->content.rdbuf() << endl; // Alternatively, use the convenience function r1->content.string()
chenzx commented 6 years ago

If readme can indicate the minimal MSVS edition SWS supports, that would be nice

chenzx commented 6 years ago

I try to modify under VS2013:

    //auto
      std::shared_ptr<HttpClient::Response> 
        r1 = client.request("GET", "/match/123");
    cout << r1->content.rdbuf() << endl; // Alternatively, use the convenience function r1->content.string()

but still compile error:

Error 1 error C2440: 'initializing' : cannot convert from 'void' to 'std::shared_ptr<SimpleWeb::ClientBase::Response>' D:\repo\Simple-Web-Server\http_examples.cpp 225 1 http_examples

eidheim commented 6 years ago

Hopefully, someone with MSVC background can answer this.

SethHamilton commented 6 years ago

It works very well on MSVC 2015. Especially the newer variants. 2013 is pretty old, and likely wasn't fully compliant.