我正在使用CMake在Visual Studio 2017下开发GoogleTest应用程序。
以下代码进行编译和链接,但是如果定义了任何测试,则在TEST宏上引发std :: bad_alloc异常。
#include <gtest/gtest.h>
TEST(WasapiSource_Test,test) { // <--- Crashes here with std::bad_alloc
}
int main(int argc,char** argv) {
::testing::InitGoogleTest(&argc,argv);
return RUN_ALL_TESTS();
}
为测试重新启动,应用程序将正常运行。