Installing g++ in Windows 10

GOAL

To install g++ in Windows10 and compile a c++ file. g++ is included in

What is g++?

g++ is the command to compile c++ and the name of C++ compiler included in GCC, the GNU Compiler Collection. You can use g++ on GNU such as Cygwin and MinGW.

Method

I’ll use MinGW

Get mingw-get-setup.exe

Access the MinGW web site and go to the Downloads page. Click and downloads mingw-get-setup.exe.

from MinGW web site

Run the downloaded file.

Click “Install” an “Continue” with your preference.

Install Basic MinGW and GCC(g++).

Mark “mingw32-base-bin” and “mingw32-gcc-g++-bin” on MinGW Installation Manager.

from MinGW Installation Manager

Click Installtion > Apply Changes

from MinGW Installation Manager

Export path

Add C:\MinGW\bin into environment variables Path.

Operation check

Open Command Prompt and input the command “g++ -v”.

Command to compile C++ file

g++ helloWorld.cpp

You can see command line options at the die.net g++(1) – Linux man page.

Appendix

Additionally install msys if you’d like to use shell with MinGW.