c-compiling and make

Make is a very useful tool and makes compiling very easy. Let’s take classical Hello World as an example. You can save the following file as hello.c

Now you can compile the code in linux box with a command

and then run it with

You can also make a simple makefile. For example you can give compiler flags to compiler with a following makefile. Save it as makefile to your programming directory

It means that the make gives the flags to c compiler. -g adds debug symbols (if you are using a debugger),  -Wall gives all warnings, -std=gnu11 uses c11 standard which is the latest c-standard and -o3 optimizes for speed.


2 thoughts on “c-compiling and make

  1. bystrodengi

    MinGW: MinGW (Minimalist GNU for Windows) is a port of the GNU Compiler Collection (GCC) and GNU Binutils for use in Windows. It also included MSYS (Minimal System), which is basically a Bourne shell (


Leave a Reply

Your email address will not be published. Required fields are marked *