Skip to main content
  1. Posts/

C/C++ Environment Setup

·

New to programming? #

Are you new to programming and want to start with C++ or C or just want to set up GCC on Windows, but online videos and everything is too complicated(at least that was my experience), then this is exactly for you.
Now let’s start with the simplest way.

minGW #

Visit sourceforge, open the directory with the latest version of minGW GCC and download the .7z file. After downloading, extract it into a folder. If you don’t have any application to extract .7z, I recommend downloading 7zip for that.
Now copy/cut the extracted directory it should be named gcc-xx.x.x-no-debug, to anywhere you want or not, it doesn’t really matter. After that go inside gcc-xx.x.x-no-debug/bin, gcc.exe g++ should be inside here. Copy the absolute location.
Now add this location to you path variable as instructed on this blog. Open new instance of the terminal and run gcc --version to check the version of gcc, and now you are ready to compile c and c++ programs.

MSYS2 #

Simply go to MSYS2’s official site and follow all the instructions mentioned here. Either add ./minGW/bin directory present inside main directory MSYS2 to path as mentioned in previous section, if not you can always use gcc or g++ using MSYS2 terminal itself.

Code::Blocks #

Visit codeblocks.org, after make your way to download page and download the file with minGW mentioned. Run the setup and install. By the end of it you will be ready to compile programs.

Note #

If you wish you can ditch gcc altogether and use some other compiler family.