firebush
firebush

Reputation: 5850

Visual Studio Compile errors in std library

I'm trying build Facebook folly in Visual Studio 2015 RC loosely following the directions provided here: https://github.com/jbandela/folly/tree/vc11

I'm hopeful that with 2015's expanded C++11 support I may have an easier time than what was possible before. I've been working through issues at a decent clip, but I'm currently getting a set of compile errors that don't make sense to me. Here's the top of the compile output with the first error:

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 '<'

Here's the source it brings me to for the location of that error, again in xstring in the std namespace:

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>
{

Another example of an error I'm getting:

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

The source:

class logic_error
    : public _XSTD exception
    {   

I'm confused by how these and the other 219 errors can arise concerning the std library itself. I usually build from Linux/g++, so I'm not familiar with the Visual Studio build environment. I may be doing something simple wrong. What can be the cause of errors like this?


Update 1

Adding more information. I reproduced this without boost, so the "Unknown compiler version" warning goes away. I also got more output from the compilation:

     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
 ...

Update 2

These errors occur with and without the precompiled header option enabled.

Upvotes: 7

Views: 3654

Answers (2)

Jamie Nicholl-Shelley
Jamie Nicholl-Shelley

Reputation: 679

Have you made sure the header dll's are the most recent; they are often updated. I have experience this when running on multiple systems with the same build. An additional check would be to add std:: at the beginning of your library call , just to make sure - that way you can easily test weather it's the dll or your spelling.

Also please check if you are receiving 'v120' or 'v140' toolset error, this indicates if you are incorrectly using a version of VS.

Another method is to include the VC lib files as a local 'header' , ensuring at least the compiler connection.

I hope that helps

Upvotes: 0

Hadi Brais
Hadi Brais

Reputation: 23639

This message:

Unknown compiler version - please run the configure tests and report the results

is emitted by one of the boost header files. Boost requires a specific version of VC++, which is in this this case 11.0 which corresponds to VS 2012. This is probably the reason why your are getting all of these errors. You have to download Visual Studio 2012 and then follow the instructions from the link you mentioned.

Upvotes: 1

Related Questions