Friday, 10 June 2016

How to use GCC and make

GCC is the main compiler for C.

To compile a C file.

gcc -o hello hello.c

Running the executable


Makefiles is used for building the whole project. This is an example file.

all: hello

hello: hello.o
     gcc -o hello hello.o

hello.o: hello.c
     gcc -c hello.c
     rm hello.o hello

Use this to build everything into a executable.


Use this to clean the project.

make clean

No comments:

Post a Comment