Simple-Web-Server icon indicating copy to clipboard operation
Simple-Web-Server copied to clipboard

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

Open chenzx opened this issue 7 years ago • 4 comments

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 avatar Dec 19 '17 04:12 chenzx

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

chenzx avatar Dec 19 '17 04:12 chenzx

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::ClientBaseSimpleWeb::HTTP::Response>' D:\repo\Simple-Web-Server\http_examples.cpp 225 1 http_examples

chenzx avatar Dec 19 '17 05:12 chenzx

Hopefully, someone with MSVC background can answer this.

eidheim avatar Dec 19 '17 10:12 eidheim

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

SethHamilton avatar Dec 20 '17 21:12 SethHamilton