c - CUnit : undefined reference to `CU_assertImplementation' -
compiled using : cc -o test testtest.c -lcunit , still cant run tests properly. crash reason :)
i'm working on project , have convinced myself should continue in testdriven approach. because project growing , want proof of functions work.
but bump problems while doing cunit tutorial. http://cunit.sourceforge.net/doc/writing_tests.html
this cunit test file :
#include <cunit/cunit.h> main(){ test_maxi(); } int maxi(int i1, int i2){ return (i1 > i2) ? i1 : i2; } void test_maxi(void){ cu_assert(maxi(0,2) == 2); cu_assert(maxi(0,-2) == 0); cu_assert(maxi(2,2) == 2); } i these errors when try compile :
testtest.c:(.text+0x62): undefined reference
cu_assertimplementation' testtest.c:(.text+0x9b): undefined reference tocu_assertimplementation' testtest.c:(.text+0xd5): undefined reference `cu_assertimplementation' collect2: ld returned 1 exit status
i used google , think got todo linking? didnt out of it.
best regards rickard
solution op.
compiled using:
gcc -wall -o test basicexample.c -lcunit
Comments
Post a Comment