Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 583
firebush Avatar asked Jul 17 '15 21:07

firebush


People also ask

How do I fix compilation error in VS code?

The fix for this error is simple: remove the PackageTargetFallback declaration from the . csproj files. After this, the project compiles without errors / warnings using dotnet build .

How do I see compile errors in Visual Studio?

To get help on a particular diagnostic message in Visual Studio, select it in the Output window and press the F1 key. Visual Studio opens the documentation page for that error, if one exists. You can also use the search tool at the top of the page to find articles about specific errors or warnings.

How do you fix compilation error in C++?

The quickest/easiest fix in this case is to make reverseWords static. Removing errors in object oriented programming works same as in procdeual programming. Read the error text, get what it means and fix it. thats all.

What causes a compile error?

A compile error happens when the compiler reports something wrong with your program, and does not produce a machine-language translation. You will get compile errors.


1 Answers

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.

like image 137
Hadi Brais Avatar answered Oct 02 '22 03:10

Hadi Brais