我今天安装了 Visual Studio 2015 专业版,并创建了一个 C++ Win32控制台应用程序

然后,我想使用C++ REST SDK(卡萨布兰卡),所以我使用NuGet包管理器下载了v14,并使用this链接创建了示例程序

但是,当我编译时,我在VS include中遇到错误。

c++ - Visual Studio 2015:C++ REST API(卡萨布兰卡)在VS包含/标题中编译失败-LMLPHP

点击了第一个错误,然后转到此处

c++ - Visual Studio 2015:C++ REST API(卡萨布兰卡)在VS包含/标题中编译失败-LMLPHP

无法理解为什么VS包含的编译失败。
因此,我创建了另一个项目,然后放入“hello world”,效果很好

请帮助

编辑:粘贴错误测试

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

最佳答案

我安装了Visual Studio Community Edition 2015。之后,我从NuGet安装了Casablanca。和所有的工作。我似乎安装已损坏/是RC,因为

卡萨布兰卡版本-> cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.8.0

关于c++ - Visual Studio 2015:C++ REST API(卡萨布兰卡)在VS包含/标题中编译失败,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38747680/

10-11 15:33