33
UBUNTU GCC COMPILATION GUIDE STEP -BY -STEP SCREENSHOTS

Ubuntu Step-By-Step Compilation Guide.pdf

  • Upload
    lymien

  • View
    225

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Ubuntu Step-By-Step Compilation Guide.pdf

UBUNTU GCC COMPILATION

GUIDE

STEP-BY-STEP SCREENSHOTS

Page 2: Ubuntu Step-By-Step Compilation Guide.pdf

1. NORMAL UBUNTU SCREEN

Page 3: Ubuntu Step-By-Step Compilation Guide.pdf
Page 4: Ubuntu Step-By-Step Compilation Guide.pdf

• There are different folders on the Desktop.

• Main concern is the folder “Infero_C_2”.

• This is the folder which contains the C Files, that are to be compiled and executed.

Page 5: Ubuntu Step-By-Step Compilation Guide.pdf

1I. FOLDER “INFERO_C_2”

Page 6: Ubuntu Step-By-Step Compilation Guide.pdf
Page 7: Ubuntu Step-By-Step Compilation Guide.pdf

• The folder contains two C Files, namely helloworld.c and helloworld_2.c

Page 8: Ubuntu Step-By-Step Compilation Guide.pdf

III. helloworld.c PROGRAM FILE

Page 9: Ubuntu Step-By-Step Compilation Guide.pdf
Page 10: Ubuntu Step-By-Step Compilation Guide.pdf

• The program is a basic Hello World Program.

• It will print the statement “Hello World Program 1”.

Page 11: Ubuntu Step-By-Step Compilation Guide.pdf

IV. BASIC TERMINAL WINDOW

Page 12: Ubuntu Step-By-Step Compilation Guide.pdf
Page 13: Ubuntu Step-By-Step Compilation Guide.pdf

• This is how the terminal window looks when it is opened.

• Shortcut :- Ctrl + Alt + T.

Page 14: Ubuntu Step-By-Step Compilation Guide.pdf

V. ls COMMAND

Page 15: Ubuntu Step-By-Step Compilation Guide.pdf
Page 16: Ubuntu Step-By-Step Compilation Guide.pdf

• The ls command is used to show the subfolders and files present in the current folder.

• As in the picture, the “home” folder contains various sub-folders like Documents, Music, Pictures, etc.

Page 17: Ubuntu Step-By-Step Compilation Guide.pdf

VI. cd COMMAND

Page 18: Ubuntu Step-By-Step Compilation Guide.pdf
Page 19: Ubuntu Step-By-Step Compilation Guide.pdf

• The cd Command is used to “change the directory”.

• To go to any subfolder we simply write cd <folder name>; as seen in the picture, how we are going to the Desktop sub-folder.

• cd .. Command is used to go one level up.

Page 20: Ubuntu Step-By-Step Compilation Guide.pdf
Page 21: Ubuntu Step-By-Step Compilation Guide.pdf

• Now by using the cd Command I have further gone into Infero_C_2 Folder, present in Desktop Folder.

• It is in this folder that I have stored my C Files.

Page 22: Ubuntu Step-By-Step Compilation Guide.pdf

VIII. gcc COMMAND

Page 23: Ubuntu Step-By-Step Compilation Guide.pdf
Page 24: Ubuntu Step-By-Step Compilation Guide.pdf

• The gcc Command is used to compile the .c file.

• In the picture, you can see I am using the gcc command to compile the helloworld.c file.

Page 25: Ubuntu Step-By-Step Compilation Guide.pdf

IX. EXECUTING THE .C FILE

Page 26: Ubuntu Step-By-Step Compilation Guide.pdf
Page 27: Ubuntu Step-By-Step Compilation Guide.pdf

• The default output file name is a.out, which is called by the command ./a.out

• This can be changed by using the -o option. (Please refer to slides if you don’t know !!)

• For a sample check out the next slide !!

Page 28: Ubuntu Step-By-Step Compilation Guide.pdf

X. OTHER COMPILATION

METHODS

Page 29: Ubuntu Step-By-Step Compilation Guide.pdf
Page 30: Ubuntu Step-By-Step Compilation Guide.pdf

• This demonstrates the compilation methods -Wall and -o.

• Please refer the slides if you do not know their significance.

Page 31: Ubuntu Step-By-Step Compilation Guide.pdf

XI. CALLING OUTPUT FILE WITH A

DIFFERENT NAME

Page 32: Ubuntu Step-By-Step Compilation Guide.pdf
Page 33: Ubuntu Step-By-Step Compilation Guide.pdf

• This demonstrates how we can call an output file, which has been given a different name by using the -o option.