c - Unity 的链接器错误(C 单元测试框架)
问题描述
我在 Stackoverflow 中乱扔垃圾,试图将 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最新的提交是不稳定的提交。我不确定在 computer_systems/tests/CMakeLists.txt 中还缺少什么来使其正常工作。只是寻找一些指导,也许我可能会从这里缺少解释https://gitlab.com/CLIUtils/modern-cmake/-/blob/master/examples/extended-project/src/CMakeLists.txt。关于更好地构建我的文件夹结构的指导也很有帮助。
解决方案
setUp
只需添加名为and的空函数teadDown
。UnityGettingStartedGuide。
推荐阅读
- android - 亚马逊定位服务添加新地理围栏
- javascript - Flask select onchange 恢复为第一个选项
- f# - F# 控制台无法识别十进制值
- active-directory - 使用 cfldap 将用户添加到 AD
- python - div id 中的“Django”类别
- laravel - Laravel 背包 - 集成 CAS
- python - 在 Python 中使用 BeautifulSoup,它返回 None 包围 '
- javascript - 处理 google.maps.infoWindow 内的按钮事件 - ReactJS
- html - 使用 VUE 更改元素
- python - 如何将 -f 要求添加到 pip requirements.txt 文件