Home» C language» C++ language» Programing» Tutorial» How to install MinGW (C and C++ programing language Compailer)
How to install MinGW (C and C++ programing language Compailer)
Posted by SkyLight Animation on Sunday, February 12, 2017
In programming language technical term Compile and Compiler. The mean of Compile is transforming the source code that write with human language into program that can running on Computer. Compiler is a tool to do that.
After compiling source code will produce one file that extension is .exe (executable file : file that can be running on windows operating system).
At this opportunity I'll explain how to install offline MinGW on Operating system Windows 7 and later. MinGW use to transform C language and C++ language into the executable file. when the executable file was running that file, that file will running look like command prompt or only on console mode, so that program is not GUI.
So this is step by step how to install MinGW :
first you must have the MinGW, if you don't have you download this file :Download MinGW
size : 155 MB
format : .Zip
Extract the file that you've download, and then copy the folder output from the extract and and paste into the localdisk C:\
Next How to Path MinGW :
1. First open view basic information about your computer,there are several ways to open the view basic information about your computer, this are ways to open :
Windows Explore Way
Following the steps :
1. Open windows explore.
2. right click in Computer and then click properties
Following the steps :
1. Open windows explore.
2. right click in Computer and then click properties
or
after use one of the ways, will appear a window like below.
2. Next click advanced system setting, to open the system properties.
this is window view of (basic information about your computer)
3. Next click Environment Variables, to open Environment Variables window.
4. In the Environment Variables window you can add new, edit, and delete variable user and system.
if in the user variables look like the picture, only have two variable, you only have add new MINGW_PATH, and PATH variable. click New... to add new variable
notice : do not remove anything on the user variables and system variables !!!
5. Add new variable PATH, fill the variable name and the variable value.
Variable name : PATH
Variable value : %MINGW_PATH%\bin
If you now in the Environment Variables there has been a PATH, don't delete
you only need edit and the paste ;%MINGW_PATH%\bin on the last of the variable value
6. Add new variable MINGW_PATH, fill the variable name and the variable value like below and click ok to save the new variable that you insert.
Variable name : MINGW_PATH
Variable value : C:\mingw
7. after insert MINGW_PATH, and PATH, the variable have been added in the list. Next click OK to save your setting
To check your MinGW have been installed on your computer :
1. Open command prompt :press your keyboard button Windows + R , that will be show the run window, type cmd on the form then press enter or click ok to open the command prompt.
after the command prompt has been open to check what version of your MINGW version type this:
gcc -v
if show the text like above that explain about the version your MinGW that you install.
Let's try to compile C and C++ and source code :
Copy this source code into the notepad and save with extension .c when the source code is c language, and .cpp if the source code is C++ program language.
C language :
#include <stdio.h>
int main()
{
printf("\n\n\t Welcome to\n Dragon Information\n");
printf("\n\t\t C language\n\n");
return 0;
}
Use this command to compile c programming language :int main()
{
printf("\n\n\t Welcome to\n Dragon Information\n");
printf("\n\t\t C language\n\n");
return 0;
}
gcc file_name.c -o new_file_name.exe
C++ language :
#include <iostream>
using namespace std;
int main(){
cout<<endl;
cout<<endl;
cout<<"\t Welcome to"<<endl;
cout<<" Dragon Information"<<endl;
cout<<endl;
cout<<"\t\t C++ language"<<endl;
cout<<endl;
}
Use this command to compile c programming language :using namespace std;
int main(){
cout<<endl;
cout<<endl;
cout<<"\t Welcome to"<<endl;
cout<<" Dragon Information"<<endl;
cout<<endl;
cout<<"\t\t C++ language"<<endl;
cout<<endl;
}
g++ file_name.cpp -o new_file_name.exe
notice : before you using the command you must enter to the folder where you save your source code!
Share:
0 comments:
Please leave some comments