In: Computer Science
compile and link two c programs from cmd prompt: using command gcc program1.c program2.h -o main
but getting error undefined reference to scheduleFCFS not sure how to correct issue.
Steps to compile and link 2 C programs from cmd Prompt are :-
Step 1 : create your 2 C program source files.
Example : "file1.c" and "file2.c". file1.c will contain your main function and file 2.c will contain function definition i.e. actual body of the function.
Step 2 : save your both the files in same location
Example : C:\Users\windows\Desktop
Step 3 : Open command prompt and run the following two commands -
a) navigate the location where you stored your files by using cd (change directory) command.
Example : assume you have placed your files on desktop - cd Desktop
b) run the C-compiler gcc : this will help you to compile your program and also create a executable file that will combine our both the programs. Run the following command and make sure both programs are in same directory
gcc file1.c file2.c -o combined
combined is the name of executable file.
c) run your executable file : make sure you are in the command from n in the same directory, type the name of the executive will file and your program will run
combined
Step 4 : Finish
Thank-You