ubuntu step-by-step compilation guide.pdf
TRANSCRIPT
![Page 1: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/1.jpg)
UBUNTU GCC COMPILATION
GUIDE
STEP-BY-STEP SCREENSHOTS
![Page 2: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/2.jpg)
1. NORMAL UBUNTU SCREEN
![Page 3: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/3.jpg)
![Page 4: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/4.jpg)
• 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](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/5.jpg)
1I. FOLDER “INFERO_C_2”
![Page 6: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/6.jpg)
![Page 7: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/7.jpg)
• The folder contains two C Files, namely helloworld.c and helloworld_2.c
![Page 8: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/8.jpg)
III. helloworld.c PROGRAM FILE
![Page 9: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/9.jpg)
![Page 10: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/10.jpg)
• 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](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/11.jpg)
IV. BASIC TERMINAL WINDOW
![Page 12: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/12.jpg)
![Page 13: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/13.jpg)
• This is how the terminal window looks when it is opened.
• Shortcut :- Ctrl + Alt + T.
![Page 14: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/14.jpg)
V. ls COMMAND
![Page 15: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/15.jpg)
![Page 16: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/16.jpg)
• 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](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/17.jpg)
VI. cd COMMAND
![Page 18: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/18.jpg)
![Page 19: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/19.jpg)
• 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](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/20.jpg)
![Page 21: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/21.jpg)
• 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](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/22.jpg)
VIII. gcc COMMAND
![Page 23: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/23.jpg)
![Page 24: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/24.jpg)
• 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](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/25.jpg)
IX. EXECUTING THE .C FILE
![Page 26: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/26.jpg)
![Page 27: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/27.jpg)
• 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](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/28.jpg)
X. OTHER COMPILATION
METHODS
![Page 29: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/29.jpg)
![Page 30: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/30.jpg)
• 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](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/31.jpg)
XI. CALLING OUTPUT FILE WITH A
DIFFERENT NAME
![Page 32: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/32.jpg)
![Page 33: Ubuntu Step-By-Step Compilation Guide.pdf](https://reader033.vdocuments.net/reader033/viewer/2022052607/589ee0301a28ab034a8c0c5c/html5/thumbnails/33.jpg)
• This demonstrates how we can call an output file, which has been given a different name by using the -o option.