Home » HOW-TO GUIDES

How to Compile C Programs

Submitted by Srikanth on Saturday, 18 July 200931 Comments

In many of my previous posts especially in the VIRUS CREATION section, I have used C as the programming language. If you’re new to C programming and find it difficult to compile the C source codes then this post is for you. Here is a step-by-step procedure to install Borland C++ compiler 5.5 and compile C programs.

How to install Borland C++ compiler

1. Download Borland C++ compiler 5.5 (for Windows platform) from the following link.

http://www.codegear.com/downloads/free/cppbuilder

2. After you download, run freecommandlinetools.exe. The default installation path would be

C:\Borland\BCC55

How to configure Borland C++ compiler

1. After you install Borland C++ compier, create two new Text Documents

2. Open the first New Text Document.txt file and add the following two lines into it

-I”c:\Borland\Bcc55\include”

-L”c:\Borland\Bcc55\lib”

Save changes and close the file. Now rename the file from New Text Document.txt to bcc32.cfg.

3. Open the second New Text Document (2).txt file and add the following line into it

-L”c:\Borland\Bcc55\lib”

Save changes and close the file. Now rename the file from New Text Document (2).txt to ilink32.cfg.

4. Now copy the two files bcc32.cfg and ilink32.cfg, navigate to C:\Borland\BCC55\Bin and paste them.

How to compile the C source code (.C files)

1. You need to place the .C (example.c) file to be compiled in the following location

C:\Borland\BCC55\Bin

2. Now goto command prompt (Start->Run->type cmd->Enter)

3. Make the following path as the present working directory (use CD command)

C:\Borland\BCC55\Bin

4. To compile the file (example.c) use the following command

Command to Compile C Program
bcc32 example.c

5. Now if there exists no error in the source code you’ll get an executable file (example.exe) in the same location (C:\Borland\BCC55\Bin).

6. Now you have successfully compiled the source code into an executable file(.exe file).

NOTE: The above tutorial assumes that you’ve installed the compiler onto the C: drive (by default).

Popularity: 8% [?]

Visitors who read this post, also read:

  1. How to Use Windows 7 Without Activation

  2. How to Enable or Disable Hibernation in Windows 7


  By using/following this site you agree to our Legal Disclaimer

Subscribe to GoHacking.Com


Enjoyed this article?
Subscribe to GoHacking.Com and get daily updates in your email for free

31 Comments »

  • rexter said:

    thank u very much…

  • sumit said:

    Hey man,
    I tried every thing, but it gives the error “unable to open include file ‘stdio.h’ ” also for all header files

  • Srikanth (author) said:

    @ sumit

    Reinstall your C compiler and configure it properly.

  • FoXriDeR said:

    hey great job btw but when i run>cmd and i type C:\Borland\BCC55\Bin is says that it is not an internal/external command.. please help!!

  • FoXriDeR said:

    i sort of get lost after how to configure it

  • Anurag Trehan said:

    hey srikant I am not able to compile files as it giving me so many errors during my compiling it So please help me….

  • Srikanth (author) said:

    @ FoXriDeR

    Type “cd\” ENTER
    then type “cd C:\Borland\BCC55\Bin” ENTER

    This should work!

  • Rameez Rehman said:

    Great job………….

  • ojas said:

    thanks bro , i hav made it , everyone that shows error use cd command b4 it and it will work.
    but i havnt tried it yet im too sacred its my sisters laptop anything happens and im dead lolz
    thankz

    Ojas

  • a.j said:

    hey srikanth..i have turbo c++ compiler..can i compile this file using it??

  • BAPPA said:

    i got a error massage about the stdio header file.
    warning-unable to open include file “stdio.h”
    -L”c:\Borland\Bcc55\lib”
    should i have to write the whole line.
    plzzzzz help me.

  • sanjay singhania said:

    hi skikant.
    my frend has got new broadband connection.and all the time he ask me
    that is anyone hacking my computer?? how can i know that.
    i replied him that i dont know.
    so atlast i want to ask you that can you tell me how can my friend
    know that someone hacking my friends broadband connection or not

  • Fawkes said:

    What’s the .c file? I get lost at the part where it tells us to move the .c file to C:\Borland\BCC55\Bin

  • Srikanth (author) said:

    @ a.j

    Yes you can compile.. but it’ll be 16-bit… You need to compile it using a 32-bit to change it’s icon…

  • CrasOveride said:

    nicely done!
    keep it up

  • Ritika Sharma said:

    Hey Shrikant,
    I have created a program (using C language)in which I have listed Tables with the help of loops.Can I save this table in *.txt format?

    Thanks in advance.Hope I’ll get some help.

  • Bill said:

    Hi. I tried compiling the codes for the usb virus in the cmd promp it said unable to open include file stdio.h. I even tried reinstalling borland and reconfigure it and it still said the same thing and i configured it right because i did exactly what you said. Please help.

  • ghost said:

    Tried to download borland c++ complier but ended up with no downloads available. Any tips from which I can download in an alternative wedsite?

  • vipan said:

    i m not able to install any of turbo c compiler on my pc and can i run block_usb.c on unix putty in hostel.if yes what steps i hav to follow to do this

  • yd15 said:

    Why can’t my files be opened on the Borland Compiler I’ve configured it right as far as I know Ive done it about 7 times…. and still get errors.

  • Srikanth (author) said:

    @ vipan

    No the block_usb.c has been coded for windows PC and not for UNIX.

  • jayan said:

    thank you….very..very..very…much..can you suggest me any tutorial or books..so i can advance in creating trojans

  • Aman said:

    Can we run this code in turbo c also or do I have to make some changes to do so and also I would like to know if we can compile and run the code using Ctrl+F9

  • pasil d'souza said:

    hey srikant. can u mail me an easy way to create a trojan. i find it hard to make by using c++ way……..

  • ravi said:

    You are genius.I am also a computer expert but I wish if i could become like you.May be in next birth…

  • Dennis S said:

    very confused…plz break it down into little baby steps for a vista user plzzzzz

  • DSAdsa said:

    i get a .obj file please help!!

  • Jason said:

    Hi Srikanth Keep up the good work.I really like what you are doing could you teach me.Im really interested.i know some basics oc C as we have programs in C in our college.

  • Richard said:

    Hi Srikanth,
    I get to the point where you enter the command promt command to compile the file. Whenever I enter “bcc32 example.c” It says that there were 18 errors in compile. And thanks for putting, so much awesome stuff up on the site.

  • fametail said:

    yes, I have the same issue as Richard. I am honestly sure I have contacted you on this B4. I am trying to compile the trojan horse using these instructions.

  • Srikanth (author) said:

    For all those who are having difficulty in compiling the programs

    It is highly recommended that you have atleast a surface level knowledge of C language and know how to work with C Compilers. Otherwise it would be hard to debug the errors. So I am sorry for all those who have problems in compiling. It’s hard for me to answer each and everyone’s queries.