Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/150.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ &引用;测试框架意外退出错误“;谷歌测试_C++_Cmake_Googletest_Clion - Fatal编程技术网

C++ &引用;测试框架意外退出错误“;谷歌测试

C++ &引用;测试框架意外退出错误“;谷歌测试,c++,cmake,googletest,clion,C++,Cmake,Googletest,Clion,我在Mac电脑上,我在用CLion做我的项目。我尝试使用google测试框架进行单元测试,但基本示例和演示都会出现以下错误: dyld:找不到符号:\uuuuuznkst7\uuuuCXX1112基本\uuStringsT11CHAR\uTraitsICESAICEEE13Get\uAllocatorEV 引用自:/path/to/google\u tests/cmake build debug/google\u tests\u run 应为:/usr/lib/libstdc++.6.dylib

我在Mac电脑上,我在用CLion做我的项目。我尝试使用google测试框架进行单元测试,但基本示例和演示都会出现以下错误:

dyld:找不到符号:\uuuuuznkst7\uuuuCXX1112基本\uuStringsT11CHAR\uTraitsICESAICEEE13Get\uAllocatorEV
引用自:/path/to/google\u tests/cmake build debug/google\u tests\u run
应为:/usr/lib/libstdc++.6.dylib

下面是一个抛出此错误的简单项目

组织机构

  • gtest_测试
    • 谷歌测试
      • 解放党
      • main.cpp
      • Test.cpp
      • CMakeLists.txt
    • CMakeLists.txt
CMakeLists.txt(根目录)

CMakeLists.txt(在google_测试中)

Main.cpp

int main () {
    return 0;
}
Test.cpp

#include "gtest/gtest.h"

TEST(TestSuite, Test1){ // 12/2/2020 -> 737761
EXPECT_EQ(1, 1);
}
在lib中,我从官方存储库中克隆了代码

当我克隆CLion google测试教程中使用的存储库时,我会遇到同样的错误

更新 事实证明,这根本不是谷歌测试的问题。我的gcc安装是罪魁祸首,我通过运行
brew doctor
发现我的gcc安装没有链接。链接和升级安装修复了该问题。我希望这对某人有帮助

int main () {
    return 0;
}
#include "gtest/gtest.h"

TEST(TestSuite, Test1){ // 12/2/2020 -> 737761
EXPECT_EQ(1, 1);
}