Error

C++博客 首页 新随笔 联系 聚合 管理
  217 Posts :: 61 Stories :: 32 Comments :: 0 Trackbacks
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
posted on 2012-12-10 15:09 Enic 阅读(1101) 评论(3)  编辑 收藏 引用 所属分类: gtest

评论

# re: gtest编译出错: 编译时,error C2977 "std::tuple" too many template arguments问题的解决办法[未登录] 2012-12-11 09:46
有一个配置选项可以看一下 GTEST_HAS_TR1_TUPLE   回复  更多评论
  

# re: gtest编译出错: 编译时,error C2977 "std::tuple" too many template arguments问题的解决办法 2012-12-11 10:53 Enic
我搜索下代码看看,确实有这个东西,看注释应该是可以选择启用,关闭,或者使用gtest自带的版本@无
  回复  更多评论
  

# re: gtest编译出错: 编译时,error C2977 "std::tuple" too many template arguments问题的解决办法 2013-11-18 00:25 Enic
编译chromium的时候也遇到了同样的问题,各种定义都无效,最后还是找到原来的帖子,,,唉,,,

在C/C++ --> “预处理器”--> “预处理定义”中增加以下行即可:
_VARIADIC_MAX=10

这一招生效了,,,  回复  更多评论
  


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理