linking problem with gcc
i have several functions written in different source files all in the same directory. i wrote the prototypes of theses functions in a header file called "filter.h" and included this header file in necessary functions. the main function is in a file called "filter.c". the directory looks like below:
/root/src/ |-- filter.c |-- filter.h |-- makefile |-- shrink.c ...(and other functions) my makefile is like below: filter: filter.o gcc -L/root/src filter.o filter.o: filter.c filter.h gcc -c -I/root/src filter.c when i type "make" in the console, i get these messages: gcc -c -I/root/exp3 filter.c gcc -L/root/exp3 filter.o filter.o(.text+0x25): In function `main': : undefined reference to `shrink' collect2: ld returned 1 exit status "shrink" is the only funcion used in "main". there is no problem in compiling, so i suppose the linker doesn't see my header file "filter.h".where do i make the mistake? |
Try this:
Code:
filter: filter.c shrink.o |
All times are GMT -5. The time now is 03:21 AM. |