Contains 3 folders and a file makefile
The directory structure is as follows:
Makefile
INC/Hello. h
Main/Main. c
Src/Hello. c
Make the MAKEFILE file out, so that the generated. O and executable files are all out. After cleaning, the files will be clean and the structure will be clear.
The file content is as follows:
Makefile )::
# String declaration <br/> objects = Main. O hello. O </P> <p> # command <br/> app: $ (objects) <br/> CC-O app $ (objects) <br/> main. o: Main/main. c hello. h <br/> CC-C main/main. c <br/> hello. o: src/hello. c stdio. h <br/> CC-C src/hello. c </P> <p> # search paths <br/> vpath %. h/usr/include Inc </P> <p> # clean the intermediate files <br/>. phony: Clean <br/> clean: <br/> RM app $ (objects) <br/>
Hello. h:
Void Hello (char name []);
Main. C:
# Include <stdio. h> <br/> # include ".. /INC/hello. H "<br/> // The second hello. h shoshould in "" <br/> int main () <br/> {<br/> Hello ("GCC"); <br/> printf ("Haha Linux Ubuntu! /N "); <br/> return 0; <br/>}
The second file, hello. H, must use "". If <> is used, GCC only searches the system directory and does not search the current directory.
Is "" in the user directory, <> in the system directory, This is not strict on Windows, it seems very strict in Linux
Hello. C:
# Include <stdio. h> </P> <p> void Hello (char name []) <br/> {<br/> printf ("Hello % s! /N ", name); <br/>}< br/>