Ex.No.
3 INSTALL AND EXECUTE C COMPILER IN VIRTUAL MACHINE
Aim:
To install a C compiler in Virtual machine and execute sample program using
Virtual box.Requirements:
1. VirtualBox software
2. Ubuntu OS of version ubuntu-15.10-desktop-i386
3. gcc compiler installed in Ubuntu OS and exported the virtual machine as ubuntu
os withgcc.ova file.
4. first.c program
Procedure:
1. Open VirtualBox.
2. Select File -> Import Appliance -> Select file named ‘ubuntu15 with gcc.ova’ ->
Open ->Next -> Import.
3. Select ‘ubuntu15’ virtual machine and select start button.
4. Enter into terminal mode and type as ‘sudo nano first.c’.
5. Type the content of the file given below for first.c.
6. Press ctrl+o and ctrl+x key combinations for saving the file and exit from the editor
moderespectively.
7. For compiling, type the command as: gcc first.c –o first
8. For execution of the file, type as: ./first
9. Now result of the C program will be displayed.
Sample C program:
first.c file
#include<st
dio.h>int
main(void)
{
printf(“My first C Program\n”);
}
1
Screenshots