问题
I installed Visual Studio 2015 Professional edition today and created a C++ Win32 console application
Then I want to use C++ REST SDK (Casablanca), so I downloaded it v14 using NuGet package manager And created a sample program using this link
However, when I compiled, I am getting errors in VS includes..
Clicked on first error, it takes to here
Can't understand why VS includes are failing compilation. So, I created another project and just put "hello world" and it worked fine
Please help
Edit: Pasting error test
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtr1common(100): error C2737: 'std::is_same_v': 'constexpr' object must be initialized
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtr1common(100): error C2998: 'const bool std::is_same_v': cannot be a template definition
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtr1common(245): error C2737: 'std::is_integral_v': 'constexpr' object must be initialized
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtr1common(245): error C2998: 'const bool std::is_integral_v': cannot be a template definition
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtr1common(282): error C2737: 'std::is_floating_point_v': 'constexpr' object must be initialized
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtr1common(282): error C2998: 'const bool std::is_floating_point_v': cannot be a template definition
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtr1common(295): error C2737: 'std::is_arithmetic_v': 'constexpr' object must be initialized
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtr1common(295): error C2998: 'const bool std::is_arithmetic_v': cannot be a template definition
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xstddef(697): error C2737: 'std::is_function_v': 'constexpr' object must be initialized
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xstddef(697): error C2998: 'const bool std::is_function_v': cannot be a template definition
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\limits(1113): error C3861: '__builtin_huge_valf': identifier not found
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\limits(1118): error C3861: '__builtin_nanf': identifier not found
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\limits(1123): error C3861: '__builtin_nansf': identifier not found
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\limits(1176): error C3861: '__builtin_huge_val': identifier not found
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\limits(1181): error C3861: '__builtin_nan': identifier not found
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\limits(1186): error C3861: '__builtin_nans': identifier not found
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\limits(1239): error C3861: '__builtin_huge_val': identifier not found
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\limits(1244): error C3861: '__builtin_nan': identifier not found
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\limits(1249): error C3861: '__builtin_nans': identifier not found
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\type_traits(524): error C2275: '_To': illegal use of this type as an expression
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\type_traits(521): note: see declaration of '_To'
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\type_traits(526): note: see reference to class template instantiation 'std::is_assignable<_To,_From>' being compiled
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\type_traits(524): error C2275: '_From': illegal use of this type as an expression
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\type_traits(522): note: see declaration of '_From'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\type_traits(524): error C3861: '__is_assignable': identifier not found
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\type_traits(524): error C2975: '_Val': invalid template argument for 'std::integral_constant', expected compile-time constant expression
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtr1common(21): note: see declaration of '_Val'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\type_traits(1245): error C2061: syntax error: identifier '__make_integer_seq'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\type_traits(1249): error C2065: '_Vals': undeclared identifier
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\type_traits(1249): error C2975: '_Vals': invalid template argument for 'std::integer_sequence', expected compile-time constant expression
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\type_traits(1190): note: see declaration of '_Vals'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\type_traits(1252): error C2061: syntax error: identifier 'make_integer_sequence'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\type_traits(1261): error C2631: 'identity': a class or enum cannot be defined in an alias template
1>c:\users\arunav\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1\stdafx.cpp : fatal error C1903: unable to recover from previous error(s); stopping compilation
回答1:
I installed Visual Studio Community Edition 2015. After that I installed Casablanca from NuGet. And all worked. I seems that the installation was corrupted / was a RC, as
Casablanca Version --> cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.8.0
来源:https://stackoverflow.com/questions/38747680/visual-studio-2015-c-rest-api-casablanca-failing-compilation-in-vs-includes