这是错误:
2> Http.cpp
2> ...packages\cpprestsdk.2.1.0\build\native\include\cpprest/streams.h(459): error C2766: 显式专用化;已定义“Concurrency::streams::_type_parser_integral_traits<utf16char>”
2> ...\packages\cpprestsdk.2.1.0\build\native\include\cpprest/streams.h(454) : 参见“_type_parser_integral_traits<unsigned short>”的前一个定义
这是那段代码:
判断如果是Windows,就定义两个宏
.....
#ifdef _MS_WINDOWS
#define _INT_TRAIT(_t,_low,_high) template<> struct _type_parser_integral_traits<_t>{typedef std::true_type _is_integral;typedef std::false_type _is_unsigned;static const int64_t _min = _low;static const int64_t _max = _high;};
#define _UINT_TRAIT(_t,_low,_high) template<> struct _type_parser_integral_traits<_t>{typedef std::true_type _is_integral;typedef std::true_type _is_unsigned;static const uint64_t _max = _high;};
_INT_TRAIT(char,INT8_MIN,INT8_MAX)
_INT_TRAIT(signed char,INT8_MIN,INT8_MAX)
_INT_TRAIT(short,INT16_MIN,INT16_MAX)
_INT_TRAIT(utf16char,INT16_MIN,INT16_MAX) // 这是 454 行
_INT_TRAIT(int,INT32_MIN,INT32_MAX)
_INT_TRAIT(long, LONG_MIN, LONG_MAX)
_INT_TRAIT(long long, LLONG_MIN, LLONG_MAX)
_UINT_TRAIT(unsigned char,UINT8_MIN,UINT8_MAX)
_UINT_TRAIT(unsigned short,UINT16_MIN,UINT16_MAX) // 这是 459 行
_UINT_TRAIT(unsigned int,UINT32_MIN,UINT32_MAX)
_UINT_TRAIT(unsigned long, ULONG_MIN, ULONG_MAX)
_UINT_TRAIT(unsigned long long, ULLONG_MIN, ULLONG_MAX)
#else
#define _INT_TRAIT(_t) template<> struct _type_parser_integral_traits<_t>{typedef std::true_type _is_integral;typedef std::false_type _is_unsigned;static const int64_t _min = std::numeric_limits<_t>::min();static const int64_t _max = (std::numeric_limits<_t>::max)();};
#define _UINT_TRAIT(_t) template<> struct _type_parser_integral_traits<_t>{typedef std::true_type _is_integral;typedef std::true_type _is_unsigned;static const uint64_t _max = (std::numeric_limits<_t>::max)();};
_INT_TRAIT(char)
_INT_TRAIT(signed char)
_INT_TRAIT(short)
_INT_TRAIT(utf16char)
_INT_TRAIT(int)
_INT_TRAIT(long)
_INT_TRAIT(long long)
_UINT_TRAIT(unsigned char)
_UINT_TRAIT(unsigned short)
_UINT_TRAIT(unsigned int)
_UINT_TRAIT(unsigned long)
......