首页 > 代码库 > CUnit 安装笔记
CUnit 安装笔记
今天安装 CUnit,发现几个坑,在此记一下。
首先下载 CUnit: http://cunit.sourceforge.net/
安装过程:
tar jxvf CUnit-2.1-3.tar.bz2 cd CUnit-2.1-3 ./bootstrap ./configure make make install
cc -o tests/build-tests tests/httptest.c /tmp/ccl6l4rB.o: In function `test1‘: httptest.c:(.text+0x3b): undefined reference to `CU_assertImplementation‘ /tmp/ccl6l4rB.o: In function `test2‘: httptest.c:(.text+0x66): undefined reference to `CU_assertImplementation‘ /tmp/ccl6l4rB.o: In function `main‘: httptest.c:(.text+0x7d): undefined reference to `CU_initialize_registry‘ httptest.c:(.text+0x86): undefined reference to `CU_get_error‘ httptest.c:(.text+0x9f): undefined reference to `CU_add_suite‘ httptest.c:(.text+0xaf): undefined reference to `CU_cleanup_registry‘ httptest.c:(.text+0xb4): undefined reference to `CU_get_error‘ httptest.c:(.text+0xcc): undefined reference to `CU_add_test‘ httptest.c:(.text+0xe7): undefined reference to `CU_add_test‘ httptest.c:(.text+0xf1): undefined reference to `CU_cleanup_registry‘ httptest.c:(.text+0xf6): undefined reference to `CU_get_error‘ httptest.c:(.text+0x102): undefined reference to `CU_basic_set_mode‘ httptest.c:(.text+0x107): undefined reference to `CU_basic_run_tests‘ httptest.c:(.text+0x10c): undefined reference to `CU_cleanup_registry‘ httptest.c:(.text+0x111): undefined reference to `CU_get_error‘ collect2: ld returned 1 exit status make: *** [build-tests] Error 1
在编译的时候加 -lcunit 就可以了,例如我的makefile:
build-tests : tests/httptest.o cc -o tests/build-tests tests/httptest.c -lcunit tests/httptest.o : tests/httptest.c test : build-tests tests/build-tests
./build-tests: error while loading shared libraries: libcunit.so.1: cannot open shared ob
sudo ln -s /usr/local/lib/libcunit.so.1 libcunit.so.1
CUnit 安装笔记
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。