What are the different steps to form an executable file from C source code ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What are the different steps to form an executable file from C source code ?

24th Jun 2020, 1:41 PM
Sourashis Paul
Sourashis Paul - avatar
2 Answers
0
For Windows : - Step 1) Download MinGW installer from the internet. Step 2) Install it. Step 3) You'll see a folder named MinGW in C Drive. Navigate to C:/MinGW/bin and copy the path. Step 4) Set the path as Environment Variable. Step 5) Navigate to the location where the C source file is stored. Step 6) Open cmd/powershell on that location. Step 7) Type "gcc <yourfilename>.c" Note : This will try to compile your code, and if there is any error, it will display in the screen. Step 8) Correct the errors in the source file and save it then retry the Step 7. Note : After sucessful compilation, you'll get a a.exe file in the same location where the C sourse file is stored. This is the executable file which can produce the result of the C code. Alternatively, a newbie can install some IDE like CodeBlocks, Dev C++ etc. etc. to Compile a code and produce the executable (.exe) file. For Linux : - Step 1) Open terminal and type "sudo apt-get install gcc" Step 2) After successful completion of installation, navig
24th Jun 2020, 4:23 PM
Arkadev Banerjee
Arkadev Banerjee - avatar
0
Step 2) After successful completion of installation, navigate to the any preferable location using terminal (by using cd commands) and then type "touch <anyfilename>.c". Note : This will create a C source file. Step 3) After successful completion of typing the C code. Save it. Step 4) In the terminal, being at the same location as of the C code, type "gcc <yourfilename>.c". Note : This will try to compile the source code. If there is any error showing, correct the mistakes in the code file then retry the step 4. After successful completion, a file named "a.out" will be created which is the executable file and can be used to produce the result. Alternatively, there are plenty of IDEs available to do the same for linux too. And, if you want to know what happens internally (within the system)throughout the process, then reply me with a "Yes".
24th Jun 2020, 4:32 PM
Arkadev Banerjee
Arkadev Banerjee - avatar