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

Linker error with Unity (C unit testing framework)

我在 Whosebug 上到处乱扔,试图让 Unity 单元测试框架 (https://www.throwtheswitch.org/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

我在这里记录了我最后的尝试 https://github.com/aamarin/computer_systems/tree/dev with the latest commit being the unstable commit. I'm not sure what else I'm missing in computer_systems/tests/CMakeLists.txt to get this working. Just looking for some guidance and maybe an explanation I might be missing from here https://gitlab.com/CLIUtils/modern-cmake/-/blob/master/examples/extended-project/src/CMakeLists.txt。关于更好地构建我的文件夹结构的指南也很有帮助。

只需添加名为 setUpteadDown 的空函数。 UnityGettingStartedGuide.