0% found this document useful (0 votes)
21 views

Computer Science & Engineering: Department of

The document details the steps to install a C compiler within a virtual machine and run basic C programs. These steps include setting up a virtual machine, installing an operating system, updating package managers, installing the GCC compiler, writing a basic C program, compiling the program with GCC, and running the compiled program.

Uploaded by

Vivek Tiwari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Computer Science & Engineering: Department of

The document details the steps to install a C compiler within a virtual machine and run basic C programs. These steps include setting up a virtual machine, installing an operating system, updating package managers, installing the GCC compiler, writing a basic C program, compiling the program with GCC, and running the compiled program.

Uploaded by

Vivek Tiwari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Experiment - 1.2
Student Name:Baddam Deepthi priya UID:21BCS10172
Branch:BE-CSE Section/Group:628-A
Date of Performance:20/01/24 Semester:6th
Subject:CC&DS Lab Subject code:21CSP-378
1. Aim:
To install a C compiler within the virtual machine established using VirtualBox
and run basic programs.
2. Objective: Install a C compiler in OS of virtual machine of Host system and
then run a basic c program.

3. Steps to Install:
Step 1: Set Up a Virtual Machine:
• Download and install VirtualBox on your host machine.
• Create a new virtual machine within VirtualBox.
• Install an operating system on the virtual machine (e.g., Ubuntu, Fedora,
etc.). You can download the ISO image of the OS from their official
websites. For this experiment I installed linux lite.

Step 2: Start the Virtual Machine:


• Start the virtual machine and log in to the operating system.
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Step 3: Update the Package Manager:


• Open a terminal on your virtual machine.
• Run the following commands to update the package manager:
sudo apt # For Debian/Ubuntu-based
update systems

Step 4: Install the C Compiler (GCC):

• Run the following command to install the GCC compiler:


sudo apt install build- # For Debian/Ubuntu-based This will
essential systems install the
necessary
tools and libraries for compiling C programs.
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
Step 5: Write and Compile a Basic C Program:
• Use a text editor to write a simple C program (e.g., use nano, vim, or gedit).
• Save the program with a .c extension, for example, file.c.
• Write a basic printf program:

Step 6: Open a terminal and navigate to the directory where you saved your C
program.
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

• Compile the program using the following command: gcc file.c -o file
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Step 7 : Run the compiled program:


DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Learning Outcome:
 Understand how to create Virtual Machines with OS.
 Learned how to use linux terminal.
 Learned how to install various resources in linux.
 Wrote a basic C program on text editor and compiled it on gcc using linux
terminal.
 Executed a basic C program.

You might also like