cpprestsdk icon indicating copy to clipboard operation
cpprestsdk copied to clipboard

Doesn't build with c++17 (VS 2017 15.5)

Open VikingExplorer opened this issue 9 years ago • 26 comments

Update 3 is causing compiler errors in CppRestSdk v 2.8

2>C:\Dev\Couloir\3pLibs\cpprestsdk-master\Release\include\cpprest/streams.h(900): error C2187: syntax error: 'identifier' was unexpected here 2>C:\Dev\Couloir\3pLibs\cpprestsdk-master\Release\include\cpprest/streams.h(1133): note: see reference to class template instantiation 'Concurrency::streams::basic_istream<_CharType>' being compiled 2>C:\Dev\Couloir\3pLibs\cpprestsdk-master\Release\include\cpprest/http_msg.h(553): error C2039: 'to_utf16string': is not a member of '`global namespace'' 2>C:\Dev\Couloir\3pLibs\cpprestsdk-master\Release\include\cpprest/http_msg.h(553): error C3861: 'to_utf16string': identifier not found

					return buffer.bumpc().then([](

#ifndef _WIN32 // Required by GCC typename #endif 900 --.> concurrency::streams::char_traits::int_type) { return false; });

Compilation: c++14 /permissive- /Zc:throwingNew /Zc:inline /bigobj

Is there a simple code change I can make?

VikingExplorer avatar Aug 17 '17 12:08 VikingExplorer

@VikingExplorer Thanks for your response. Yeah, I don't think hard coding specific versions of libraries works too well in the real world. :) In a big application, you may have multiple dependencies on boost, and obviously you can't have multiple versions of a library linked into the same application. I guess this kind of complex dependency is another plus for micro services, but in my case pulling out the new cpprest dependency into another service (another process) is not feasible. Anyways... I did get it to build and run. The heap corruption problem was a result of my own stupidity. I realized I was trying to build my app against different versions of the header files than the lib version I was linking to. Yikes!

bandrews-spirent avatar Sep 18 '17 14:09 bandrews-spirent

I was a bit scattered brain on this, so let me clarify the "issue". It's still happening with VS2017 15.5 c++17 cpprest_2_10.

Error C3083 '`global namespace'': the symbol to the left of a '::' must be a type (compiling source C:\Dev\Couloir\3pLibs\vcpkg\installed\x64\include\cpprest\http_msg.h 571

To fix it, I've been changing cpprest source code like this:

FROM: void set_body(const utf16string &body_text, utf16string content_type = ::utility::conversions::to_utf16string("text/plain"))

TO: void set_body(const utf16string &body_text, utf16string content_type = L"text/plain")

VikingExplorer avatar Dec 09 '17 16:12 VikingExplorer

Error C7510 'int_type': use of dependent type name must be prefixed with 'typename' (compiling C:\Dev\Couloir\3pLibs\vcpkg\installed\x64\include\cpprest\streams.h 890

FROM: #ifndef _WIN32 // Required by GCC

TO: //#ifndef _WIN32 // Required by GCC & MSVC

VikingExplorer avatar Dec 09 '17 17:12 VikingExplorer

We did notice some of these issues and they should hopefully all be solved in master. Could you check and give us a second opinion?

If all is well, I'll look at making a new release soon.

ras0219-msft avatar Dec 10 '17 02:12 ras0219-msft

I found that the int_type error goes away if you disable SDL checks

georgiosd avatar Jan 08 '18 16:01 georgiosd

6 months is too long to wait. Fixed by switching to boost::beast

VikingExplorer avatar Feb 03 '18 19:02 VikingExplorer