17 Jan 2012

Install and Run Turbo C from Command Line


 

Hi guys. I covered few topics of Java Programming in some of my previous articles. But seriously speaking I don't like java as much as I love programming with C\C++. From today I'll start writing articles on C\C++ Programming as well. Your suggestions and Queries are always welcome.
Lets start with installing and configuring the C\C++ compiler. Here I will show you how to work with Turbo C++ in GUI and in command line. But other modern compilers like Borland C, Pelles C++ and dev C++ are also recommended.

System Requirement:
  • Windows XP/7/Vista
  • Turbo C compiler. download it from here
  • Free time
Installing the Turbo C:
  • First extract the downloaded zip file into your C: drive.
  • Now open the folder and click on install.exe. You'll see the start window. Press Enter
  • In the SOURCE drive field put C. press Enter
  • Leave the source path as default. You can change it if required. Press Enter
  • Now press F9 to begin the installation.
  • After the end of installation you can view the README file for more details.
Configuring the Turbo C:
  • right click on My Computer > properties > Advanced tab > select Environment Variables
  • In system variable field select Path then click on edit.
  • In the variable value field write "C:\TC\bin;" which is the default path of the compiler. click ok

Compile and Execute the Program:
  • Open notepad and copy the following code into it:
          #include<stdio.h>
          int main()
          {
          printf("Hello World");
          return 0;
          }
          save the file as first.c in the directory C:\TC\BIN (default location)
  • open the command prompt and move to the directory C:\TC\BIN
  • In the cmd window type the compilation code which is: 
          tcc first.c      /*where first.c is the name of C program file*/
  • If no error occurs then the code is compiled. To execute your file type first.exe

The advantage of using command prompt is that you can compile your program anytime anywhere. Try different commands from the turbo C help menu.


Keep Learning. Keep Rocking.
Cheers :)

0 comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Online Project management