Install Compiler Toolchain
First, you will need to install a compiler - the program that will build your code once it is written. The instructions for this vary based on your platform:
MinGW is the name of a project to make the
gcc compiler available on Windows. Use
this link to download the file
Once downloaded, find the file in Windows Explorer. Right-click it and select
Extract All.... For the location, type:
Once this is done, your C: drive should have a folder called
mingw64 in it.
In that folder, you should see folders called
Now you need to add
C:\mingw64\bin to your Path (the list of folders Windows
looks in for programs it can run). To do so, follow these
Add to the PATH
After pressing New to add a new item to the Path, type or copy/paste in
This video demonstrates the process:
You will need to install the XCode command line development tools. You can do this either by typing a command or using the app store:
To install via a command, open a Terminal window. Then type the following:
For more information, check out this page which has screenshots and a video of the process.
Alternatively, you can install the full XCode application (Apple's official development environment). This is a larger install but also sets up your computer to do development specifically for OSX and/or iOS. To do this method, simplify find XCode in the app store and install it.
You need to install packages that contain
make (among other tools).
On Ubuntu and other apt-based distros you can do this by running the following commands
in a terminal:
sudo apt update sudo apt install build-essential sudo apt install gdb
Testing the compiler
To confirm the compiler is installed, open a terminal window (Terminal/Power Shell/Command Prompt on Windows, Terminal on Mac). and type the following:
If you get an error saying something like
g++: fatal error: no input files, you are good to
go. If you get an error saying something like `g++ is not recognized as a command
Download VSCode and install it.
Then you need to install some extensions that will add features to VSCode.
Open VS Code and hit
Ctrl-Shift-X. In the search bar, type/paste each of the following one at a time.
After finding each extension, click it and then click the Install button.
See here for more information
on install extensions.
ms-vscode.cpptools cantonios.project-templates cschlosser.doxdocgen
If you are on a Mac, you will also want to install this extra Extension:
This video demonstrates setting up VSCode and setting up the project templates (which is the next step). Make sure to still read the instructions below, especially if you are on a Mac/Linux.
Project Template Setup
We provide some project templates you will want to use to easily set up coding projects. They are provided as a .zip file - begin by downloading it: ProjectTemplates.zip.
When you open that .zip, you should see a folder called ProjectTemplates. You need to put that folder in a specific location depending on your operating system.
PC Template Setup
Hit the Windows (start) key and then type or paste this:
%APPDATA%\Code\User\ and hit enter.
That should open a folder on the path
C:\Users\YOURNAME\AppData\Roaming\Code\User. That is
where you want to place the ProjectTemplates folder.
Mac Template Setup
Command-Shift-G to open up the Go To Folder feature. Type or paste
and hit enter. That will open up the folder where you want to place the ProjectTemplates folder.
Linux Template Setup
~/.config/Code/User/ProjectTemplates - that is where you will want to place the
Testing the Project Templates
Make a new empty folder on your computer.
Open VSCode and do
File > Open Folderto open the folder you created.
ctrl-shift-pand start typing
Project: Create From Template. As soon as you see that option appear you can select it and hit enter.
When prompted, type a project name like
HelloWorld. Then provide your name. The tool should generate files in your folder.
F5or go to the menu option
Run > Start Debugging. Your program should build and display "Hello World" in the Terminal pane at the bottom of the window.
If you are on a Mac, you may need to first switch to the Run and Debug view:
And then select Run Program (Mac):
before running your project will work