make file for compiling c and c++ in linux
Let's understand with an example: Suppose, we have 3 files main.c (main source file), misc.c (source file that contains function definition), misc.h (that contain function declaration). Here we will declare and define a function named myFunc() to print something – this function will be defined and declared in misc.c and misc.h respectively. misc.c 1 2 3 4 5 6 7 8 #include <stdio.h> #include "misc.h" /*function definition*/ void myFunc( void ) { printf ( "Body of myFunc function.\n" ); } misc.h 1 2 3 4 5 6 7 #ifndef MISC_H #define MISC_H /*function declaration.*/ void myFunc( void ); #endif main.c 1 2 3 4 5 6 7 8 9 10 11 #include <stdio.h> #include "misc.h" ...
Comments
Post a Comment