Getting Started
- Review the syllabus.
- Access the textbook (Chapter 1 for the first week).
- Set up the required software.
- Say "hi" to your instructor.
Instructors
Visual Studio Code
To program in C++, you will need a text editor and a compiler. For a text editor, we will use Visual Studio Code. For a compiler, we will use g++ from the GNU Compiler Collection (GCC). Follow the instructions below to setup both.
Visual Studio Code is an excellent text editor that works in macOS and Windows, is accessible from the command line, and has a great dark color scheme by default.
These small changes will make it easier to properly format your code.
After installing Visual Studio Code, open it.
Press
Ctrl + Shift + P
(orCmd + Shift + P
on a Mac) to open the Command Pallet.Type
Settings (JSON)
in the textbox and click on the dropdown as shown here.On the left, you see all of the default settings. On the right, you can add your own.
Add these two settings. You can replace the existing values or add these fore the existing values (inside the curly brackets).
json{ "editor.insertSpaces": false, "editor.rulers": [80], "editor.renderWhitespace": "boundary", "editor.guides.bracketPairs": true, "editor.bracketPairColorization.enabled": true, }
MacOS: Launching VS Code from the command line
On a Mac, you will need to perform the following steps to run VS Code from the terminal:
- Launch VS Code.
- Open the Command Palette (
⇧⌘P
i.e.,Cmd+Shift+P
) and typeshell command
to find the Shell Command: Install 'code' command in PATH command. - Restart the terminal for the new
$PATH
value to take effect. You'll be able to typecode .
in any folder to start editing files in that folder.
The g++ Compiler
- GCC (GNU Compiler Collection)
- 100% free software
- Known as the Linux compiler, but cross platform
- g++ is the GCC C++ Compiler
Complete one of the sets of instructions below depending of if your computer that runs Windows or macOS.
Installing G++ in Windows
On Windows, we will use the MinGW-w64 to compile C++ programs using g++.
- MinGW (Minimalist GNU for Windows)
- Includes GCC
- MinGW-w64 is an updated branch of MinGW
Download the following:
Follow the following video instructions to set up your system.
Installing G++ on Apple Silicon (M1, M2, M3) Macs
- The default C++ compiler for macOS is clang, which is similar but now what we are using in this course.
- Installing GNU’s g++ compiler (GCC) has become a lot easier.
Install Homebrew by opening the “Terminal” and pasting in the following command.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Use Homebrew to install the GCC compiler with the following Terminal command.
Go to where GCC was installed in the Terminal by typing:
cd /opt/homebrew/bin
Add a link to g++-14 to g++ by typing:
ln -s g++-14 g++
WARNING
The path may be different as new versions are released. If the above command does not work, type
ls
to see what number you should use instead of14
in the above command.Sign out and sign back into your computer.
Installing G++ on Intel-Based Macs
- The default C++ compiler for macOS is clang, which is similar but now what we are using in this course.
- Installing GNU’s g++ compiler (GCC) has become a lot easier.
Installation Steps:
Install Homebrew by opening the “Terminal” and pasting in the following command.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Use Homebrew to install the GCC compiler with the following Terminal command.
brew install gcc
Go to where GCC was installed in the Terminal by typing:
cd /usr/local/bin/
Add a link to g++-14 to g++ by typing:
ln -s g++-14 g++
WARNING
The path may be different as new versions are released. If the above command does not work, type
ls
to see what number you should use instead of14
in the above command.Sign out and sign back into your computer.
Using the Lab Computers
You may log into the lab computers with your personal account.
- Username: Combine your First Initial, Middle Initial, and Last Name* (like the beginning of your CSU email address).
For example,JDSmith
- Password:
Change1stTime!
There is a “special” Window’s command-line interface installed that includes MinGW-w64.
- From the start menu (or the search), start typing “MinGW”.
- Right click on “Run terminal” and select “Pin to Start” for easy access in the future.
- Open “Run terminal” to access the CLI that includes our compiler.
- Do NOT pin it to the taskbar.