Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/62.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
Unity的链接器错误(C单元测试框架)_C_Unit Testing_Cmake_Unity Test Framework - Fatal编程技术网

Unity的链接器错误(C单元测试框架)

Unity的链接器错误(C单元测试框架),c,unit-testing,cmake,unity-test-framework,C,Unit Testing,Cmake,Unity Test Framework,我在Stackoverflow中尝试将Unity单元测试框架()链接并构建在CMAKE上,以便编写单元测试,但我一直遇到相同的错误: Undefined symbols for architecture x86_64: "_setUp", referenced from: _UnityDefaultTestRun in libunity.a(unity.c.o) "_tearDown", referenced from: _UnityDefaultTestRun

我在Stackoverflow中尝试将Unity单元测试框架()链接并构建在CMAKE上,以便编写单元测试,但我一直遇到相同的错误:

Undefined symbols for architecture x86_64:
  "_setUp", referenced from:
      _UnityDefaultTestRun in libunity.a(unity.c.o)
  "_tearDown", referenced from:
      _UnityDefaultTestRun in libunity.a(unity.c.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/test_problem2_59.exe] Error 1
make[1]: *** [tests/CMakeFiles/test_problem2_59.exe.dir/al

我在这里记录了我的最后一次尝试,最新的提交是不稳定提交。我不确定我在computer_systems/tests/CMakeLists.txt中还缺少了什么来让它工作。只是想寻求一些指导,也许是我在这里遗漏的一个解释。关于如何更好地构建我的文件夹结构的指导也很有帮助。

只需添加名为
setUp
teadDown
的空函数即可