我从Unity for C 单元测试库中复制了最简单的代码,并设置了一个非常基本的测试,我从该站点复制并粘贴了该代码:
#include "unity/src/unity.h"
int main(void)
{
UNITY_BEGIN();
int a = 1;
TEST_ASSERT( a == 1 ); //this one will pass
TEST_ASSERT( a == 2 ); //this one will fail
return UNITY_END();
}
我在终端中输入的内容:
gcc TestDumbExample.c ./unity/src/unity.c -o Test
我在终端中收到此错误消息:
/tmp/ccqgFGn8.o: In function `UnityDefaultTestRun':
unity.c:(.text+0x26af): undefined reference to `setUp'
unity.c:(.text+0x26ca): undefined reference to `tearDown' collect2:
error: ld returned 1 exit status
Unsure why this error is occurring and it has undefined references.