我在C中使用单元测试时遇到了问题,我尝试在我的计算机中安装CUnit,并在包含了库之后。
我一直跟随steeps安装CUnit:
1 - download the sources
2 - configure it using "./configure --prefix='/lib' "
3 - make (only make)
4 - sudo make install这是我的测试源文件,它没有进行测试,但是我不能编译它,我在"CUnit.h:没有这样的文件或目录“之前得到了这个错误:
#include "CUnit.h"
#include <stdlib.h>
#include <stdio.h>
int main(){
print("Hello");
return 0;
}我想知道,我如何安装CUnit来使用我的测试源文件!
提前谢谢。
编辑
哈哈,我知道了!
我只是在没有参数的情况下运行配置,如下所示:
"./configure"发布于 2012-05-14 17:56:11
如代码示例中所示,您应该使用如下内容:
#include <CUnit/CUnit.h>因为每个CUnit包含都位于CUnit子目录中(通常在/usr/local/include/CUnit中)
发布于 2013-03-08 15:01:46
如何添加-I/lib/include标志以包括安装在/lib/include/CUnit和-lcunit -L/lib/CUnit/lib中的头文件,以便与已安装的库进行链接?
gcc test_file_source.c -I/lib/include -lcunit -L/lib/CUnit/lib -o testing
https://stackoverflow.com/questions/10588378
复制相似问题