Skip to main content

Posts

Showing posts with the label gcc

Compiling and Building C/C++ Programs in Windows with MinGW Compiler

The most popular open source C/C++ compilers for Windows are MinGW and Cygwin. MinGW is much less tedious to install hence I will start with this. Cygwin? Let's do that another day... Process of Installing MinGW 1. Locate the MinGW installer (let's assume 64bit) 2. Download 3. Run installer (assume on C:/MinGW folder 4. Configure PATH 5. Test How to Compiler and Build  a C/C++ Program 1. Write the source and save in desired folder (e.g. Hello.c) 2. Change directory to the one containing the source file 3. Run the Command Prompt, Power Shell or other shell such as Git BASH in this folder. [Shift+Right-Click will bring up a popup to allow the first two shells. Right-Click will allow you to run the Git BASH. See details below). 4. Issue the compiler command: gcc -o hello.exe hello.c  which means: Compile source file called Hello.c and name the output file Hello.exe 5. Run the output file as follows: ./Hello  Locate MinGW Installer  Google "mingw64"...