Home > OS >  The processing of a makefile header files
The processing of a makefile header files

Time:09-19

Write a have main_jj. C, fun_jj. C head_jj. H makefile project and implement a sum fun_jj function, main_jj calls the sum function and print it out, the result to headers declare the function sum, if after modifying two addend in main_jj, observe the make command execution, the other is fixed, is still a makefile don't know how to get the header file in a makefile to how to write ah  , new online such as

CodePudding user response:

Mafile scripts you have any question,
Header file if in the same now, don't need to reflect in the Makefile, in the c file, include "XXX. H
"If you are integration environment, the different, otherwise inside the terminal shell: make -f makfile

All:
GCC -o test test. C test1. C test2. C...

If there are other paths of header files, plus - I... .

CodePudding user response:

My_result: fun_jj. O main_jj. O head_jj. H
GCC fun_jj. O main_jj. C head_jj. H - o my_result
Fun_jj. O: fun_jj. C
GCC fun_jj. C - c
Main_jj. O: main_jj. C
GCC main_jj. C - c
The clear:
rm -f *.o

CodePudding user response:

My direct change name is ok, I just tried, can
  • Related