Reputation: 9
I am installing the MinGW compiler suite in the directory C:\MinGW
and also set PATH environment. I don't know about uses in any project, and I want to compile my program with the GCC compiler, but I don't know the steps. How do I compile my program with GCC?
Upvotes: 0
Views: 852
Reputation: 1290
1. Download MinGW
2. Check mingw folder exist in C drive. If it exist go to step 3.
3. set environment variable in environment name "c:\mingw\bin" and press OK.
4. Go to command Prompt type mingw-get install gcc
5. after the installation of gcc, type powershell in command prompt.
6. from powershell Browse to the folder where your source files are residing.
7. type "gcc yourprogram.c", it will compile the source code
8. type "./a.exe" you will get your output on console. Enjoy
Upvotes: 0
Reputation: 311
I usually install MinGW from SourceForge using the automated installation.
Select "mingw-get". Then, by sure to install the GCC C++ compiler features. To check the installation is OK, write "gcc -v" from the command line. You should view the GCC version.
If it doesn't work, check your system paths. "C:\MinGW\bin" should be correcty configured.
To develop your applications in an easy and fast way, you could download Eclipse-CDT for Windows.
Eclipse doesn't need any installation. Decompress it in a directory you want and ready to work. If it doesn't work, you will probably need to install a Java virtual machine previously.
Eclipse automatically detects your MinGW installation, so you don't need to do anything.
Create a new C-project (select the test proyect "Hello World" or write your own), and then compile and run.
Upvotes: 0