C2977: 'std::tuple' : too many template arguments (MSVC11)

前端 未结 7 1983
清歌不尽
清歌不尽 2020-12-13 03:53

I\'m trying to build googletest with Visual C++ 11, but following code causes an error

template 

        
7条回答
  •  -上瘾入骨i
    2020-12-13 04:40

    In Visual Studio 2012 (VC11) _VARIADIC_MAX is by default defined as 5 in header :

    #if !defined(_VARIADIC_MAX)
     #define _VARIADIC_MAX  5
    
    #elif _VARIADIC_MAX < 5 || 10 < _VARIADIC_MAX
     #error _VARIADIC_MAX must be between 5 and 10, inclusive
    #endif /* !defined(_VARIADIC_MAX) */
    

    if you have multiple VC11 projects include in a solution, it is better to set the macro to all by

    1) Shift click to select all C++ projects in your solution

    2) Properties, C/C++, Preprocessor, All Configurations All Platforms, Preprocessor Definitions,

    3) add before a row

    _VARIADIC_MAX=10;
    

    You can change 10 to any number in 6~10.

提交回复
热议问题