我正在尝试按照此处提供的说明在 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 '<'
这是它带给我该错误位置的来源,再次在 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>
{
我收到的另一个错误示例:
C2039 'exception': is not a member of 'std' folly c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdexcept 27
来源:
class logic_error
: public _XSTD exception
{
我很困惑这些和其他 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
...
更新 2
无论是否启用预编译头选项,都会发生这些错误。