Visual Studio编译std库中的错误

fir*_*ush 7 c++ visual-c++ visual-studio-2015 folly

我正在尝试按照此处提供的说明松散地在Visual Studio 2015 RC中构建Facebook愚蠢:https: //github.com/jbandela/folly/tree/vc11

我希望通过2015年扩展的C++ 11支持,我可能比以前更容易.我一直在处理一个不错的剪辑问题,但我现在得到一组对我没有意义的编译错误.这是编译输出的顶部,第一个错误:

2>------ Build started: Project: folly, Configuration: Debug Win32 ------
2>  pch.cpp
2>  Unknown compiler version - please run the configure tests and report the results
2>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xstring(26): error C2143: syntax error: missing ',' before '<'
2>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xstring(26): error C2143: syntax error: missing ',' before '<'
Run Code Online (Sandbox Code Playgroud)

这是它带来的错误位置的源代码,同样在std命名空间的xstring中:

template<class _Mystr>
class _String_const_iterator
    : public _Iterator012<random_access_iterator_tag, // <---- line 26
        typename _Mystr::value_type,
        typename _Mystr::difference_type,
        typename _Mystr::const_pointer,
        typename _Mystr::const_reference,
        _Iterator_base>
{
Run Code Online (Sandbox Code Playgroud)

我得到的另一个错误示例:

 C2039  'exception': is not a member of 'std'   folly   c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdexcept    27
Run Code Online (Sandbox Code Playgroud)

来源:

class logic_error
    : public _XSTD exception
    {   
Run Code Online (Sandbox Code Playgroud)

我很困惑这些和其他219错误如何出现关于std库本身.我通常使用Linux/g ++构建,所以我不熟悉Visual Studio构建环境.我可能做了一些简单的错误.这样的错误可能是什么原因?


更新1

添加更多信息.我没有提升就重现了这一点,因此"未知的编译器版本"警告消失了.我还从编译中获得了更多输出:

     Microsoft (R) C/C++ Optimizing Compiler Version 19.00.22816 for x86
     Copyright (C) Microsoft Corporation.  All rights reserved.

     cl /c /I"C:\Users\myname\Documents\Visual Studio 2015\Projects\folly\folly\folly\folly" /I"C:\Users\myname\Documents\Visual Studio 2015\Projects\folly\folly\\" /I"Generated Files\\" /IDebug\ /ZI /ZW /ZW:nostdlib /W3 /WX- /sdl /MP /Od /Oy- /D _VARIADIC_MAX=10 /D FOLLY_NO_CONFIG /D _TIMESPEC_DEFINED /D FOLLY_HAVE_STD__IS_TRIVIALLY_COPYABLE /D _UNICODE /D UNICODE /D _DEBUG /D WINAPI_FAMILY=WINAPI_FAMILY_APP /D __WRL_NO_DEFAULT_LIB__ /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Yc"pch.h" /Fp"Debug\folly.pch" /Fo"Debug\\" /Fd"Debug\vc140.pdb" /Gd /TP /wd4453 /wd28204 /FU"C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.VCLibs\14.0\References\CommonConfiguration\neutral\platform.winmd" /FU"C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.FoundationContract\1.0.0.0\Windows.Foundation.FoundationContract.winmd" /FU"C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\1.0.0.0\Windows.Foundation.UniversalApiContract.winmd" /FU"C:\Program Files (x86)\Windows Kits\10\References\Windows.Networking.Connectivity.WwanContract\1.0.0.0\Windows.Networking.Connectivity.WwanContract.winmd" /analyze- /errorReport:prompt /bigobj pch.cpp

     pch.cpp
 1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xstring(26): error C2143: syntax error: missing ',' before '<'
     c:\program files (x86)\microsoft visual studio 14.0\vc\include\xstring(266): note: see reference to class template instantiation 'std::_String_const_iterator<_Mystr>' being compiled
 1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xstring(27): error C2518: keyword 'typename' illegal in base class list; ignored
 1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xstring(28): error C2518: keyword 'typename' illegal in base class list; ignored
 1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xstring(29): error C2518: keyword 'typename' illegal in base class list; ignored
 ...
Run Code Online (Sandbox Code Playgroud)

更新2

启用和不启用预编译头选项时会发生这些错误.

Had*_*ais 1

这条信息:

未知的编译器版本 - 请运行配置测试并报告结果

由 boost 头文件之一发出。Boost 需要特定版本的 VC++,在本例中为 11.0,对应于 VS 2012。这可能是您收到所有这些错误的原因。您必须下载 Visual Studio 2012,然后按照您提到的链接中的说明进行操作。