I have installed a C library on my computer (Ubuntu) called xx
, whose header file is at /usr/local/include/xx/xx.h
and the .a file
and .so file
are in the path /usr/local/lib
named libxx.a
and libxx.so
.
The test file:
#include<xx/xx.h>
#include<stdio.h>
int main(){
printf("Test\n");
call_function_declared_in_the_header_file();
return 0;
}
When I use gcc to compile gcc test.c -o test, I get the following error:
/tmp/ccb7O0eh.o: In function `main':
test.c:(.text+0xa): undefined reference to `call_function_declared_in_the_header_file'
collect2: error: ld returned 1 exit status
I don't know why. I am not good at the C language. So how can I fix it?