gtest编译出错: 编译时,error C2977 "std::tuple" too many template arguments问题的解决办法

gtest编译出错: 编译时,error C2977 "std::tuple" too many template arguments问题的解决办法
1. 编译时,error C2977 "std::tuple" too many template arguments问题的解决办法
网文http://www.cnblogs.com/fresky/articles/2455058.html中的方案如下:
打开 c:\program files (x86)\Microsoft Visual Studio 11.0\VC\include\xstddef,把 _VARIADIC_MAX定义成10。
这个方案一方面需要Administrator,其实是需要System权限才能修改Windows 8中的System文件,另一方面,会对所有的C/C++代码造成影响
其实,更简单的方法是打开“解决方案资源管理器”,右键打开项目“属性”,在C/C++ --> “预处理器”--> “预处理定义”中增加以下行即可:
_VARIADIC_MAX=10
坑爹吧?

/////////////////////////////////////////////
// date: 2012-12-11
上面的问题是vc的tr1/tuple引起的,后来高手指点下知道gtest是有一个宏来控制这个东东的,,,

//   GTEST_HAS_TR1_TUPLE      - Define it to 1/0 to indicate tr1::tuple
//                              is/isn't available.
//   GTEST_HAS_SEH            - Define it to 1/0 to indicate whether the
//                              compiler supports Microsoft's "Structured
//                              Exception Handling".
//   GTEST_HAS_STREAM_REDIRECTION
//                            - Define it to 1/0 to indicate whether the
//                              platform supports I/O stream redirection using
//                              dup() and dup2().
//   GTEST_USE_OWN_TR1_TUPLE  - Define it to 1/0 to indicate whether Google
//                              Test's own tr1 tuple implementation should be
//                              used.  Unused when the user sets
//                              GTEST_HAS_TR1_TUPLE to 0.



// Determines whether Google Test can use tr1/tuple.  You can define
// this macro to 0 to prevent Google Test from using tuple (any
// feature depending on tuple with be disabled in this mode).
#ifndef GTEST_HAS_TR1_TUPLE
// The user didn't tell us not to do it, so we assume it's OK.
# define GTEST_HAS_TR1_TUPLE 1
#endif  // GTEST_HAS_TR1_TUPLE
// Determines whether Google Test's own tr1 tuple implementation
// should be used.
#ifndef GTEST_USE_OWN_TR1_TUPLE
// The user didn't tell us, so we need to figure it out.


using vs2012
gtest tuple build error
gtestport.h
#define GTEST_USE_OWN_TR1_TUPLE 0
#define GTEST_HAS_TR1_TUPLE 0

你可能感兴趣的:(gtest编译出错: 编译时,error C2977 "std::tuple" too many template arguments问题的解决办法)