Originally Posted by
GReaper
So, obviously, getch.o( and everything else not in that directory ), need to be prefixed with the relative or absolute path, eg:
../mainop/getch.o
Sorry, I didn't understand. You mean I need to include all the .c? but I just need the .o of getch.c since the getanumber.c only use two functions from this source. Hum, the header calc.h declares the functions of getch.c and the others functions that are inside mainop directory. Still, I'd like to compile getch only.
I tried some variations but it didn't work. gcc -I ../mainop -o maingetanumber getanumber.o -include ../mainop/getch.o -Wall -pedantic
Code:
maingetanumber : getanumber.o getch.o
gcc -include ../mainop/getch.o -o maingetanumber getanumber.o -Wall -pedantic
getanumber.o : getanumber.c
gcc -I ../headers -c getanumber.c
Code:
maingetanumber : getanumber.o getch.o
gcc -I ../mainop -o maingetanumber getanumber.o ../mainop/getch.o -Wall -pedantic
getanumber.o : getanumber.c
gcc -I ../headers -c getanumber.c
Code:
gcc -I ../mainop -o maingetanumber getanumber.o -include ../mainop/getch.o -Wall -pedantic