Install Turbo C in your computer’s C Drive and follow the below shown commands to open it.
METHOD 1: Using command prompt.
Step1: Win + R ; will open a run command prompt.
Step2: Type cmd and hit Enter ; will open command prompt.
Step3: Now type cd\ and hit Enter (will takes you to root directory i.e C drive)
Step4: Type cd TC and hit Enter (Now you are in TC folder)
Step5: Type cd bin and hit Enter ( Now you are redirected to bin folder, a subfolder in tc)
Step6: Type TC and hit Enter (will open TC window now you can write edit and compile your programs, through this command you are accessing an application called TC.exe )
METHOD 2: Navigating through folders.
Step1: Go to C Drive
Step2: Open TC folder
Step3: Open BIN folder
Step4: Double click on TC.exe
We are doing pretty much same in both the methods :).
Step2: Type Terminal
Step3: Click on Terminal
Step4: Now type vim <your filename with extension .c> Ex. vim prog1.c (This will create a file prog1.c and opens it in a editor called vim)
Step5: Press i to get into insert mode and now you can type your program here.
Step6: After typing your program press escape to get out of insert mode and type ‘:wq’ without quotes and hit enter (This will make you to come out of vim editor by saving the file)
Step7: Now type gcc <your file name with .c extension> and hit enter to compile your file.
Step8: To execute your file type ./a.out and hit enter. This will run the file
METHOD 1: Using command prompt.
Step1: Win + R ; will open a run command prompt.
Step2: Type cmd and hit Enter ; will open command prompt.
Step3: Now type cd\ and hit Enter (will takes you to root directory i.e C drive)
Step4: Type cd TC and hit Enter (Now you are in TC folder)
Step5: Type cd bin and hit Enter ( Now you are redirected to bin folder, a subfolder in tc)
Step6: Type TC and hit Enter (will open TC window now you can write edit and compile your programs, through this command you are accessing an application called TC.exe )
METHOD 2: Navigating through folders.
Step1: Go to C Drive
Step2: Open TC folder
Step3: Open BIN folder
Step4: Double click on TC.exe
We are doing pretty much same in both the methods :).
How_to_TC2-1
How to Compile a C program using GCC
- GCC – GNU compiler collection is a GNU project which supports C , C++, Fortran, Java, Ada and Go.
- GCC for windows is available .
- Well Ubuntu provides inbuilt GCC, it is not required to install it externally so I prefer to use Ubuntu, it is available for free, download Ubuntu. .
- In Ubuntu follow below commands to write, edit and compile your programs.
Step2: Type Terminal
Step3: Click on Terminal
Step4: Now type vim <your filename with extension .c> Ex. vim prog1.c (This will create a file prog1.c and opens it in a editor called vim)
Step5: Press i to get into insert mode and now you can type your program here.
Step6: After typing your program press escape to get out of insert mode and type ‘:wq’ without quotes and hit enter (This will make you to come out of vim editor by saving the file)
Step7: Now type gcc <your file name with .c extension> and hit enter to compile your file.
Step8: To execute your file type ./a.out and hit enter. This will run the file
- We are indicating file name as a.out because in gcc after compiling the C file it will store it as a.out (where as in windows it stores as .exe). Thus in linux whatever the name you use to name a file the execution file is generated as a.out only, thus same command is used for all the files.
- Don’t have Linux? Are you using windows? But want to compile using GCC compiler?
- There are softwares that can install GCC on windows platform MinGW, Cygwin.
- Most people now days are addicted to windows environment but most industries work on linux so they search for people who is handy with linux operating sytems, so it’s better to get addicted to linux from now.
Now as you are ready with your compiler and editor or an IDE. Let’s start our journey.
No comments:
Post a Comment