Practical 1
Aim- download and install c/gcc compiler for windows.
Step 1: download the mingw installer:
Open the browser and visit the official mingw website.
https://sourceforge.net/mingw/
on the page click download to get the mingw installer.
-
Step 2: open the file go to download option click on it and find
mingw and click to double tap:
After double -clicking on the setup file , mingw installation manager
will now open. It will show the like version,name,etc. click on the
install button and proceed to start the installation.
Step 3: Specify installation preferances.
Now the installation manager will ask to specify installation
preference. For that you will ask to choose the installation directory.
If you wish to change it , you can browser the explore and speciy the
location as per requirement. After that click and continue to further.
Step 4: Download and set up mingw installation manager.
Click on continue now automatically download the required files for
mingw to install on windows system. And wait few minutes till
downloading all the files.
Step 5: select packages required for the compiler.
There are three packages required for the basic mingw setup that you
have to choose from the mingw installation manager.
1 . first install mingw base32-base package. This package use to
compile the c program, including linker and other binery tools. Right-
click on the the mingw32 -base optionand select mark for
installation.
2 . now install the mingw32-gcc-g++ packeges. This package used to
compile c++ source code. It is only required if you going to program in
c++ only. To select mark for installation.
3 . now install the ingw32-gcc-objc packages , right click on it and
select mark for intallation. It is only required if going to program in
objective c.
Step 6: apply the changes.
After seleting all the required packages, go to installation >>apply
change and click on apply changes.
Step 7: download the changes.
Now download all packages select in previous step.click on apply and
proceed to download and install them.
The download for the packages the packages will now begin as
shown in the window below.
Step 9: installation copleted.
Click on close to close installation manager.
Now the installation of mingw is finished. To check if is install or not ,
open command prompt and type g++ --version.
Currently, the command prompt cannot detect the mingw
compiler(gcc) because the environment path variable has not been
set.
Setting up path variable
Step 1: copy the path of mingw bin.
In folder – now you go to bin folder,click on the addres bar and copy
the address.
Step 2: open edit system varaiable.
Step 3: edit the path.
Click on edit and go to new and paste the path of mingw
bin(C:\mingw\bin).
Setup a new path.
Paste the path.
Creating and running a c program
Step 1: hello world in C. To execute a c program , create a text file.
Step 2: Type the C code and save the file.
Step 3: open command promt.
Compile the c program:-to compile hello world that we wrote earlier ,
type gcc hello.c and press enter
Step 5: Complication completed. The copiled file will be saved in the
same directory with the name a. the type of the will be application.