最近在VS2019的工程中集成gtest,发现报错如下:
error C2039: 'tr1': is not a member of 'std'
error C3083: 'tr1': the symbol to the left of a '::' must be a type
原因:可能是C++11新特性导致
解决方案:
在CmakeLists文件中预定义 _HAS_TR1_NAMESPACE 宏,通知编译器支持C++11
add_compile_definitions(_HAS_TR1_NAMESPACE)