I have been given to create two header files, h1.h and h2.h; two c files, a1.c and a2.c; and one main file, mainfile.c. a1 file includes h1 header file, a2 includes h2 header file and mainfile includes both header files. Now I want to link them together to get a single executable .exe file.
I know that if only 1 header file (x.h) is present with two c files (a1.c and a2.c), we can use:
gcc -c a1.c gcc -c a2.c gcc -o x_exe a1.o a2.o ./x_exe
Can anyone suggest something of the same format for my problem?