wooin 发表于 2007-1-4 16:40:33

请问这里有用CUnit的吗?帮帮我吧。。。

我看了文章《C语言单元测试》,然后在Linux下编译了CUnit,但是按照文章中的方法建立一个有三个文件的工程:
1.func.c :定义maxi()函数
2. test_func.c :定义测试用例和测试包
3. run_test.c :调用CUnit的Automated接口运行测试
4. Makefile :生成测试程序。

但是在编译的时候老是报错:
/tmp/ccg2VV4R.o(.text+0x36): In function `testIQJ':
: undefined reference to `CU_assertImplementation'
/tmp/ccg2VV4R.o(.text+0x6c): In function `testIQJ':
: undefined reference to `CU_assertImplementation'
/tmp/ccg2VV4R.o(.text+0xab): In function `testIGJ':
: undefined reference to `CU_assertImplementation'
/tmp/ccg2VV4R.o(.text+0xe1): In function `testIGJ':
: undefined reference to `CU_assertImplementation'
/tmp/ccg2VV4R.o(.text+0x118): In function `testIGJ':
: und
...........

应该是头文件和库文件链接的有问题吧?
能详细给我描述一下你是如何编译安装的吗?
configure --prefix= 用的是什么?
这些例子文件的目录结构是怎么样的吗?

谢谢。。。

天网 发表于 2007-1-23 13:29:53

不懂CUnit,但根据编译报错来分析,应该是头文件包含不对,编译时没有找到CU_assertImplementation定义的地方。可以查找一下CU_assertImplementation是在Cunit哪个头文件里定义的。
页: [1]
查看完整版本: 请问这里有用CUnit的吗?帮帮我吧。。。