Tuesday, 18 October 2011

MinGW - Getting Started

What is MinGw??
MinGW (Minimalist GNU for Windows), formerly mingw32, is a native software port of the GNU Compiler Collection (GCC) and GNU Binutils for use in the development of native Microsoft Windows applications; 

MinGW can function either as a cross compiler targeting Windows or as a native toolchain run on Windows itself. It is deployed along with a set of freely distributable import libraries and header files for the Windows API.

Source : Wikipedia


First you have to be familiar with basic DOS command. Go here for basic cmd.
Before continue, make sure you have installed MinGW.


Open up an elevated command prompt window and set the current directory to where your *.cpp file is.

Example:
For the file calculator.cpp in the folder C:\doc, change your directory using the following command:

cd c:\doc

This is the compile command:

g++ calculator.cpp -o calculator.exe

The -o switch defines the name of the output file.
Now you can run your program by typing the name of the executable file:

calculator.exe


No comments:

Post a Comment