Creation and execution of C Programmes in Windows environment using MinGW compiler
Title
Question
Dear Sir/Madam, I have successfully installed MinGW compiler on my \r\nsystem in windows environment. But in tutorial segment the demo has been\r\n given only of program execution in ubuntu operating system. So kindly \r\nguide me how to use this MinGW compiler in windows environment.
Thanks & regards
Suneel
Thanks & regards
Suneel
C-and-Cpp First-C-Program 00-01 min 0-10 sec
Answers:
Greetings Suneel,
Kindly have a look on the C and C++ Installation & Instruction Sheet from the following links to proceed further.
<a href="http://spoken-tutorial.org/media/videos/43/C-and-Cpp-Installation-Sheet-English.pdf" style="line-height: 1.42857; background-color: rgb(250, 250, 250);" target="_blank" title="Installation Sheet">Installation Sheet</a>
<a href="http://spoken-tutorial.org/media/videos/43/C-and-Cpp-Instruction-Sheet-English.pdf" target="_blank" title="Instruction Sheet">Instruction Sheet</a>
Dear Suneel,
Try this link<a href="https://turboc.codeplex.com/downloads/get/1489512" target="" title="C++ Turbo"> C++ Turbo</a> and download the zip file. Install the executable file.
Try this link<a href="https://turboc.codeplex.com/downloads/get/1489512" target="" title="C++ Turbo"> C++ Turbo</a> and download the zip file. Install the executable file.
How to compile and execute a C and C++ program using GCC compiler?
1.<span style="white-space:pre"> </span>Type the following program in notepad or notepad++
// First C Program
#include<stdio.h>
int main()
{
printf("Talk to a Teacher\n");
return 0;
}
2.<span style="white-space:pre"> </span>Save the program with .c extension in the folder where you have installed GCC compiler and cygwin. In my Laptop, I have installed in
C:\cygwin64\bin>
Filename: Tutorial1.c
3.<span style="white-space:pre"> </span>Compile the program in the command prompt with admin privilege :
C:\cygwin64\bin>gcc -o hello Tutorial1.c
If the program doesn’t have error, an EXE file name hello.exe created in the same folder.
4.<span style="white-space:pre"> </span>Run the program (EXE file hello.exe) in the command prompt:
C:\cygwin64\bin>hello
A message will be displayed in the cmd window for this program:
Talk to a Teacher
How to compile and execute a C and C++ program using GCC compiler?
1.<span style="white-space:pre"> </span>Type the following program in notepad or notepad++
// First C Program
#include<stdio.h>
int main()
{
printf("Talk to a Teacher\n");
return 0;
}
2.<span style="white-space:pre"> </span>Save the program with .c extension in the folder where you have installed GCC compiler and cygwin. In my Laptop, I have installed in
C:\cygwin64\bin>
Filename: Tutorial1.c
3.<span style="white-space:pre"> </span>Compile the program in the command prompt with admin privilege :
C:\cygwin64\bin>gcc -o hello Tutorial1.c
If the program doesn’t have error, an EXE file name hello.exe created in the same folder.
4.<span style="white-space:pre"> </span>Run the program (EXE file hello.exe) in the command prompt:
C:\cygwin64\bin>hello
A message will be displayed in the cmd window for this program:
Talk to a Teacher
How to compile and execute a C and C++ program using GCC compiler?
1.<span style="white-space:pre"> </span>Type the following program in notepad or notepad++
// First C Program
#include<stdio.h>
int main()
{
printf("Talk to a Teacher\n");
return 0;
}
2.<span style="white-space:pre"> </span>Save the program with .c extension in the folder where you have installed GCC compiler and cygwin. In my Laptop, I have installed in
C:\cygwin64\bin>
Filename: Tutorial1.c
3.<span style="white-space:pre"> </span>Compile the program in the command prompt with admin privilege :
C:\cygwin64\bin>gcc -o hello Tutorial1.c
If the program doesn’t have error, an EXE file name hello.exe created in the same folder.
4.<span style="white-space:pre"> </span>Run the program (EXE file hello.exe) in the command prompt:
C:\cygwin64\bin>hello
A message will be displayed in the cmd window for this program:
Talk to a Teacher
How to compile and execute a C and C++ program using GCC compiler?
1.<span style="white-space:pre"> </span>Type the following program in notepad or notepad++
// First C Program
#include<stdio.h>
int main()
{
printf("Talk to a Teacher\n");
return 0;
}
2.<span style="white-space:pre"> </span>Save the program with .c extension in the folder where you have installed GCC compiler and cygwin. In my Laptop, I have installed in
C:\cygwin64\bin>
Filename: Tutorial1.c
3.<span style="white-space:pre"> </span>Compile the program in the command prompt with admin privilege :
C:\cygwin64\bin>gcc -o hello Tutorial1.c
If the program doesn’t have error, an EXE file name hello.exe created in the same folder.
4.<span style="white-space:pre"> </span>Run the program (EXE file hello.exe) in the command prompt:
C:\cygwin64\bin>hello
A message will be displayed in the cmd window for this program:
Talk to a Teacher
Login to add comment
1. Write the program in Notepad++ in some folder in a drive (E.g. Create a folder programinDdrive)
#include<stdio.h>
void main()
{
printf("hello");
}
Give a file name Sample.cand Click File menu and save it
Take command prompt by typing cmd in Run
Then change directory to the place where you saved the file (E.g your file Sample. c is in D:\\program)
Type
D:
cd program
(This will give a prompt D:\\program>)
2. COMPILE THE PROGRAM
Type
gcc Sample.c -o sample
(Here sample.exe will become the name of the output file)
press enter key
This will compile the program
If no error nothing will be shown. Otherwise it will show error details then correct the error and again compile)
/If no error RUN the program
type
sample.exe
Regards
Renetha J.B
Dear Ms.Renetha,
While following the instructions for Windows, while compiling, I got the below error :
fatal error : studio.h : No such file or directory
#include<studio.h>
compilation terminated^
Could you please support on this error
Regards,
Jagadeesh S
Jagadeesh S
question reverted. error identified.
Sorry
Login to add comment
Dear Ms.Renetha,
While following the instructions for Windows, while compiling, I got the below error :
fatal error : studio.h : No such file or directory
#include<studio.h>
compilation terminated^
Could you please support on this error
Regards,
Jagadeesh S
Jagadeesh S
<span style="font-size:14.0pt;font-family: "Times New Roman","serif"">GCC and GCC++ compiler download in Windows</span>
<span style="font-size:14.0pt;font-family:"Times New Roman","serif";mso-fareast-font-family: "Times New Roman"">1.<span style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 7pt; line-height: normal; font-family: "Times New Roman";"> </span></span><span style="font-size:14.0pt;font-family:"Times New Roman","serif"">Weblink for software download:<o:p></o:p></span>
<a href="https://gcc.gnu.org/install/binaries.html"><span style="font-size:14.0pt;font-family:"Times New Roman","serif"">https://gcc.gnu.org/install/binaries.html</span></a><span style="font-size:14.0pt;font-family:"Times New Roman","serif""><o:p></o:p></span>
<span style="font-size:14.0pt;font-family:"Times New Roman","serif""> </span>
<span style="font-size:14.0pt;font-family:"Times New Roman","serif";mso-fareast-font-family: "Times New Roman"">2.<span style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 7pt; line-height: normal; font-family: "Times New Roman";"> </span></span><span style="font-size:14.0pt;font-family:"Times New Roman","serif"">Windows version:<o:p></o:p></span>
<a href="https://sourceware.org/cygwin/"><span style="font-size:14.0pt;font-family:"Times New Roman","serif"">https://sourceware.org/cygwin/</span></a><span style="font-size:14.0pt;font-family:"Times New Roman","serif""><o:p></o:p></span>
<span style="font-size:14.0pt;font-family:"Times New Roman","serif""> </span>
<span style="font-size:14.0pt;font-family:"Times New Roman","serif";mso-fareast-font-family: "Times New Roman"">3.<span style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 7pt; line-height: normal; font-family: "Times New Roman";"> </span></span><span style="font-size:14.0pt;font-family:"Times New Roman","serif"">Download 64 bit version by click on EXE file</span>
<span style="font-size:14.0pt;font-family:"Times New Roman","serif";mso-fareast-font-family: "Times New Roman"">4.<span style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 7pt; line-height: normal; font-family: "Times New Roman";"> </span></span><span style="font-size:14.0pt;font-family:"Times New Roman","serif"">Connect to internet and install this with admin privilege <o:p></o:p></span>
<span style="font-size:14.0pt;font-family:"Times New Roman","serif"">
</span>
Login to add comment