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
- 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.
- 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.
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.
- Once that has downloaded, open the file, run / install it in the normal fashion for your operation system
- 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.
- Untick “Show On Startup” near the top right corner. Of course this is down to personal preference.
- 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)
- Close down NetBeans now. That’s the easiest part over and done with. Now we must install the compiler for NetBeans to use.
- Ensure youre logged into Windows using an account with computer administrator privileges.
- Download the MinGW installer from https://sourceforge.net/projects/mingw/
- Run the MinGW installer in the same way you ran the NetBeans installer before.
- Accept the default installation settings in step 1
- Step 2… Another easy step. Sit back and wait for it to finish doing its thing, then click continue.
- In the MinGW installer select the following components to install:
- mingw32-gcc-fortran (if you will be working on Fortran programs)
- Click Installation > Apply Changes. Then click apply on the next popup, then sit back and wait for it to complete its installation
- Click Close. Almost there.
- 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.
- 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
- In the Environment Variables window, select the Path variable in the Systems Variable section and click Edit.
- Now ensure you have all of these variables
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:
- 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.