Lesson 1: Getting Set Up

This lesson is going to focus on setting up your development environment and compiler. The development environment is where we’re going to all of our hard work and the compiler is the “engine” installed onto your OS (operating system) to converts our C++ instructions into a machine-code or lower-level form so that they can be read and executed by a computer.

Installing NetBeans with MinGW Compiler

  1. Download and Install an IDE (Integrated Development Environment). I personally use NetBeans for C++ programming but there are many others available. Click Here to see the download page for NetBeans IDE.
  2. Once you’re on the downloads page you will see a section at the top of the page to select your platform or language. For this example we’re using Windows but it is available for Mac OS X and Linux.

    netbeans ide platform selection

    If you have 32 Bit Windows (Who really has that these days?) then select the “Download x86” button, If you have 64 Bit Windows then press the “Download x64” button.

    netbeans ide download

  3. Once that has downloaded, open the file, run / install it in the normal fashion for your operation system

    netbeans ide install step 1
    netbeans ide install step 2
    netbeans ide install step 3

  4. After a successful installation, launch the program. NetBeans should launch without any issues. 2 Things to note that I always do after a successful installation.
    1. Untick “Show On Startup” near the top right corner. Of course this is down to personal preference.
    2. I run the suggested updates. This will ensure that the C/C++ Libraries compilers and other IDE features are all fully up to date. (May require a restart of the NetBeans IDE after update)

    netbeans ide first launch

  5. Close down NetBeans now. That’s the easiest part over and done with. Now we must install the compiler for NetBeans to use.
    1. Ensure youre logged into Windows using an account with computer administrator privileges.
    2. Download the MinGW installer from https://sourceforge.net/projects/mingw/
    3. Run the MinGW installer in the same way you ran the NetBeans installer before.

      MinGW Installer First Screen

    4. Accept the default installation settings in step 1

      MinGW Installer Step 1

    5. Step 2… Another easy step. Sit back and wait for it to finish doing its thing, then click continue.

      MinGW Installer Step 2

    6. In the MinGW installer select the following components to install:
      • mingw-developer-toolkit
      • mingw32-base
      • mingw32-gcc-fortran (if you will be working on Fortran programs)
      • msys-base
      • mingw32-gcc-g++

      MinGW Installer Step 3a

    7. Click Installation > Apply Changes. Then click apply on the next popup, then sit back and wait for it to complete its installation

      MinGW Installer Step 3b

      MinGW Installer Step 3c

    8. Click Close. Almost there.
  6. If you’re still awake after what seems eternity downloading those files from the slow server the well done! At this point I checked NetBeans and the compiler was successfully setup (See Lesson 2). However if it is not correctly setup then follow these instructions.
    1. Open the environment variables window
      • Windows XP / Windows 2000: Right-click My Computer > Properties > Advanced tab > Environment Variables button
      • On Windows Vista and Windows 7: Right-click My Computer > Properties > Advanced System Settings link > Environment Variables button
      • Windows 8/8.1 & Windows 10: Right Click This PC > Properties > Advanced System Settings > Advanced Tab > Environment Variables button

      Environment Variables Step 1

      Environment Variables Step 2

      Environment Variables Step 3

    2. In the Environment Variables window, select the Path variable in the Systems Variable section and click Edit.

      Environment Variables Step 4

    3. Now ensure you have all of these variables
      • %SystemRoot%\system32
      • %SystemRoot%
      • %SystemRoot%\System32\Wbem
      • %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
      • C:\MinGW\bin
      • C:\MinGW\MSYS\1.0\bin

      Environment Variables Step 5

      In windows 10 this is more self explanatory and the screenshots explain it better than I could in words. However the earlier operating systems will need to do the following:

      • At the end of the path, insert a semi-colon and add the paths to the executables for MinGW and MSYS. Use semi-colons between the paths and do not use any spaces. Be careful not to remove anything already on your PATH or your computer might not work correctly.
        When you are finished, your path should look similar to the following:
    4. Click ok and accept all changes etc.

There you go. Everything should now be set-up and you’re ready to start learning C++. Hopefully it hasn’t been overwhelming so far but feel free to leave comments and ask questions below.

Add a Comment

Your email address will not be published. Required fields are marked *