使用 VS 2012 编译 GTest 遇到的编译错误

下载好gtest-1.6.0,然后解压到一个目录下,比如e:\gtest-1.6.0

如果大家尝试着用VS2012 去编译GTest (e:\gtest-1.6.0\msvc\gtest.sln),可能会碰到下面的编译错误:

\gtest\include\gtest\gtest-printers.h(550): error C2977: 'std::tuple' : too many template arguments

可是,怎么解决呢?

Q:

用VS2012打开gtest.sln,会提示升级,不用管,一路YES下去。

然后打开project的properties -> C\C++ Preprocessor -> Processor Definitions 在下拉列表里面选择<Edit...> 

在preprocessor definition 的窗口下,添加 _VARIADIC_MAX=10,然后保存。接着重新 build project 即可。

注意的是,该sln下面有四个project,这四个的属性都需要修改。

原文地址:https://www.cnblogs.com/yayagamer/p/2952464.html