<<

SCHOOL OF ELECTRICAL AND INFORMATION ENGINEERING University of the Witwatersrand II

Compiler and IDE Installation Guide

These instructions are for installing all software on Windows 64-bit systems. Before starting ensure that no other versions of the GCC are on your machine. To test if you have an existing version installed, do a search for “gcc.exe”. If you find an existing version then you should uninstall it via the Windows Control Panel before continuing. Install the software in the order given below as this makes things easier. All of the software is available directly from the course website. Downloading from the website is preferable as this will ensure that you have the correct versions of the different packages.

1 Install the GCC Compiler, Debugger and ++ Standard Lib- raries

Download the MinGW Bundle (GCC 7.3.0) from the course website. Unzip the download and copy the root folder (mingw64) to your C:\ drive. Note, you can install the compiler in a different location but ensure that there are no spaces or non- alphanumeric characters in the path.

2 Install the CodeLite IDE

Download CodeLite 12.0.3 from the course website. Unzip the download file and run the installation file. Accept the license agreement and all of the default options. Launch CodeLite and run the setup wizard. Accept the defaults and then click “Scan” on the “Setup ” dialog and sure to select “MinGW ( mingw64 )” as the compiler. Accept the default colour scheme as well as the indentation settings in order to complete the wizard. Now open the CodeLite Plugins menu as shown in Figure 1. Clear all plugins and then select only the following three: 1. HelpPlugin 2. Formatter 3. SpellCheck CodeLite will then request to restart. Click the button to restart and then in the “Closing CodeLite” dialog restart the IDE by first clicking the checkbox to remember your answer, followed by the “Save and Exit” button.

1 Figure 1: CodeLite Plugins Menu

2.1 Enable C++17

CodeLite will automatically reopen. Go to Settings|Build Settings...|Compilers. Select the “MinGW (mingw64)” compiler. In the Tools tab, append to the “C++ Compiler” entry: --std=c++17 (refer to Figure 2). Note there is a space between …exe and --std=c++17.

2.2 Test Your Setup

Download the test code (test-ide-compiler-setup.zip) from the Resources section of course website and unzip the contents to a folder which has no spaces in the path. In CodeLite select File|New|New Workspace and choose a Workspace name, such as “ELEN3009”. A Workspace is used to store all of your Projects (and you should create a separate project for each lab). Ensure that there are no spaces in the path to the workspace or the workspace name itself. After creating the workspace, select File|New|New Project. Choose a Con- sole “Simple executable (g++)” project and give it a name (such as “Test-Setup”, and click “Next”. The compiler that is selected should be “MinGW (mingw64)”, and the debugger should be “GNU gdb debugger”. After creating the project, expand the project tree so that the default “src” source code folder (containing a default main file) is visible. Right-click on this folder, and select “Remove Virtual Folder” to remove it. Right-click on the project name and select “Import Files From Directory”. Browse for the folder that you unzipped earlier and select it. Be sure to tick the check box on the “Import

2 Figure 2: Enable the compiler switch for C++17

Files” dialog, and click “OK”. Expand the project tree and double click on test-setup.cpp. Review the source code and then compile, build and run it using the keyboard shortcut Control-F9. If the program compiles and runs successfully then your setup is correct. If not, examine the compiler errors to resolve the issue/s. Remember, the demonstrators are also available to assist you.

2.3 Install the Offline Help

Download the documentation browser, Zeal, from the Resources section of the course web- site, accept the license agreement, and install it. Now run Zeal. If you are doing this at Wits, select File|Options|Network and provide the correct HTTP Proxy details. Lastly, go to File|Options|Docsets, tick the C++ checkbox and download the documentation. Now you will be able to select (double-click) any C++ keyword or standard library function in CodeLite and view the help for it by pressing F1. Try it by calling up the help for the stoi function call in test-setup.cpp. Ignore requests to update Zeal and turn off update checks in File|Options|General as there is an integration issue with the latest version.

© Copyright SP Levitt, School of Electrical and Information Engineering. Version 1.1 (4/9/2018) compiler-ide-installation.tex

3