These are the instructions for setting up, compiling, building, running, and debugging C++ programs per platform. The settings included in this repo should work on any computer with Visual Studio Code. You will also need to have the proper compilers and debuggers installed (see below). These instructions assume the default directories for the compilers.
Installation instructions for specific platforms are found in the subsequent sections. These next steps assume you have VSC and your compiler installed.
- Open up the workspace using the file
_LaunchThis.code-workspace
. This should open up VSC as a workspace with all of the necessary settings. If the file type is not already associated with VSC, do so. - Create a new, blank file (
File->New File
) from VSC. - Compile and run by hitting
[Ctrl]+[Shift]+B
on Windozzze or[command]+[shift]+B
on Mac. You can also just use the menuTerminal->Run Build Task...
. SelectBuild and Run C/C++ Application
. - To debug, you can select
[F5]
or the menuDebug->Start Debugging
.
File Names
All files MUST be named correctly as the assignment instructions dictate. This includes spacing (don't use any!), capitalization, name of the file, and the correct extensions (.cpp
). Major points will be taken off for incorrect file names and/or missing files.Header Information
Please include all requested documents for this assignment in this repository. Each file MUST include aCOMMENT AREA
near the top of the page. The comment area must include the following three lines. All assignments for the remainder of this course must contain a variation of the following three lines. You will need to fill in the bracketed sections with the appropriate information (without the square brackets).Project Name: [Title of the Project] Author: [Your Full Name] Date Last Modified: [Date Modified]
Install Visual Studio Code ( https://code.visualstudio.com/ )
- Go to the website above. Download and install the version appropriate to your computer.
- The first time you launch VSC, it will probably try to install a few plugins for handling cpp files. This is good! If it needs a little push, you can start the plugin manager (
[command or Ctrl]+[Shift]+X
) and installC/C++ for Visual Studio Code
. - Generally, you will start projects using the file
_LaunchThis.code-workspace
. This should open up VSC as a workspace with all of the necessary settings. If this file type is not already associated with VSC, do so.
Install MinGW ( http://www.mingw.org )
- Install the default installer (
mingw-get-setup.exe
) with the default options (in the default location--C:\MinGW\
). - The default installer will do a few things and then take you to the installation manager.
- From here, under
Basic Setup
, selectmingw32-gcc-g++
andmingw32-base
. - Click the menu
Installation
, thenApply Changes
and apply the pending actions. - Installer will take a while to download and install necessary components. Make sure to reboot when done.
- Click the Windozzze start button and type
advanced system settings
to bring up the system properties window. - Click on
Environment Variables
button. - In the
System variables
box at the bottom, selectPath
and press theEdit
button (at the bottom!). - Click the
New
button and typeC:\MinGW\bin
. - Close all windows and make sure to reboot when done.
Optional: Install OpenGL and GLUT ( http://www.transmissionzero.co.uk/software/freeglut-devel/ )
- Grab the latest version of FreeGLUT for MinGW from the link above and extract the files to your computer. Make sure to get the version for MinGW!
- Go to the subdirectories of that archive and find three folders:
bin
,include
, andlib
. Each of these contains files that need to be copied to the correct location for your program to compile and run. Just use the 32-bit versions (ignore any x64 files or subfolders). - Copy the file
freeglut.dll
from bin to theMinGW/bin
directory (by default, this should be something likeC:\MinGW\bin
). - Copy the four files in the folder
GL
under include to theMinGW/include/GL
directory (by default, this should beC:\MinGW\include\GL
). - Copy the two
a
(libfreeglut.a
andlibfreeglut_static.a
) files from lib to theMinGW/lib
directory (by default, this should beC:\MinGW\lib
).
- Launch the MacOS Terminal application. In case you are unfamiliar with this, it is a tool that allows you to type in commands and get their results as text output. You will be using the Terminal intermittently during the course. Type
[command]+space
to bring up Spotlight Search and typeterminal
. Press[return]
to launch. - To install the basic C++ compiler and utilities, type
xcode-select --install
and hit[return]
. When you do this, it will prompt you to confirm installation. From this point on, the installation is graphical. You will see a download window showing download and installation progress.- Note the option
Get Xcode
. Xcode is Apple's integrated development environment for developing software for its computers, phones, and other devices. If you find that interesting, go ahead and download it! However, it is not needed for the course, it is a very large download (9+ GB), the install takes longer, and you can always download it again later.
- Note the option
There is no need to install anything other than the above to get OpenGL working on a Mac. However, instead of including <GL/glut.h>
, you will need to include <GLUT/glut.h>
where ever appropriate. Also, note that not all features (especially advanced concepts like materials and textures) may not work properly.
- If you've previously installed
code-oss
andit is not working properly (installs other than version 1.29), you'll need to purge it prior to starting:sudo apt-get purge code-oss
- Download GPG signing key from PackageCloud: https://packagecloud.io/headmelted/codebuilds/gpgkey
- Import GPG key
gpg --import /home/pi/Downloads/headmelted-code-oss-0CC3FD642696BFC8.pub.gpg gpg --list-keys
- Install the PackageCloud repository for code-oss
curl -s https://packagecloud.io/install/repositories/headmelted/codebuilds/script.deb.sh | sudo bash
- Install code-oss
sudo apt-get install code-oss=1.29.0-1539702238
- Tell
apt
to hold at version 1.29, since 1.32 doesn't work properlysudo apt-mark hold code-oss
- From the terminal, simply type:
sudo apt-get install freeglut3-dev g++