Google Test in Visual Studio 2012

后端 未结 4 1195
你的背包
你的背包 2021-01-30 20:12

I am trying to get started with unit testing. I downloaded the latest build of gtest, and extracted it to A:\\gtest As the instructions specified, I opened gtest.sl

4条回答
  •  渐次进展
    2021-01-30 20:56

    VC++ 2012 does not (and will never) support variadic templates; consequently, its standard library implementation attempts to fake them using preprocessor-generated overloads and specializations. As this blog post notes, the number of faux variadic template parameters defaults to 5 – the problem is that gtest is trying to instantiate std::tuple<> with as many as 10 template arguments.

    As the blog post goes on to mention, you can define the _VARIADIC_MAX macro project-wide to support up to 10 parameters; you'll probably want to do this by way of your project's preprocessor definitions setting, but the important thing is to make sure every TU defines it before including any stdlib headers (directly or indirectly).

提交回复
热议问题