1. 編譯時(shí),error C2977 "std::tuple" too many template arguments問(wèn)題的解決辦法
打開 c:\program files (x86)\Microsoft Visual Studio 11.0\VC\include\xstddef,把 _VARIADIC_MAX定義成10。
這個(gè)方案一方面需要Administrator,其實(shí)是需要System權(quán)限才能修改Windows 8中的System文件,另一方面,會(huì)對(duì)所有的C/C++代碼造成影響
其實(shí),更簡(jiǎn)單的方法是打開“解決方案資源管理器”,右鍵打開項(xiàng)目“屬性”,在C/C++ --> “預(yù)處理器”--> “預(yù)處理定義”中增加以下行即可:
坑爹吧?
/////////////////////////////////////////////
// date: 2012-12-11
上面的問(wèn)題是vc的tr1/tuple引起的,后來(lái)高手指點(diǎn)下知道gtest是有一個(gè)宏來(lái)控制這個(gè)東東的,,,
// 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