Wednesday, November 6, 2013

Distribute your Program...

Creating executable (.Exe) file for your source code

If you want to distribute your program to dear and near ones then instead of providing source code (the actual C program) first create the executable file for your source code. To create  .Exe file for your source code follow the steps given below:

Step 1: Save the program file by pressing F2 key.

Step 2: Click on the Compile menu by using mouse and the select Make option from the popup menu or press ALT+C to invoke compile menu and the press M hot key. After linking compiler create .EXE file for your source code to your specified output directory.
OR
Press F9 function key.
Tip: If you do not know your output directory, then do not worry. To see your output directory, click on Options menu, and from the option menu click on Directories…. From the Directories dialog box, note your output directory.
If you want to specify other directory as output directory say MyOutput then add C:\TC\MyOutput in the output directory line (Remember that MyOutput directory must exist within TC directory) and click on OK. To save your settings, click on Options menu again and choose Save. From the save options dialog box, make sure that an Environment must be checked and then click on OK.
Quit TC by pressing ALT+X. Your screen may look like this:
C:\TC>
Type the command
C:\TC>CD MyOutput <ENTER>
C:\TC\MyOutput>
Now, type the name of your executable file i.e. your program name and press Enter.
C:\TC\MyOutput>Prog6 <ENTER>
Watch your program output. Now, at the command prompt type DIR/P and press Enter.
The files as well as directories will be displayed on the screen. Notice the .Obj file (Prog6.obj) will also present there.
From where the .obj file comes?

When you compile a program by using compiler, it creates .obj file. This file contains machine language code corresponding to your source code. But you cannot execute .obj files directly. Note that the linker links the .obj file, the standard library files and then produce .EXE file.

No comments:

Post a Comment