Setting up VSCode for C++ on Mac OS

I’ve decided to jump into a new language this week. Most of the drawing apps out there similar to the ones I’ve been making are built with C++, and Javascript, which I’ve mostly been using, is also written with C++. So, it seems the natural choice is to learn C++. The first step of learning any new language, is to figure out how to set up your local environment. I’m sure there’s a few ways to go about this, but I’m just going to go over what worked for me.

  1. The first step is to make sure you have the C++ extension in VSCode.

2. Make sure you have Clang installed by opening a terminal window and typing clang --version. If it’s not installed, type xcode-select --install.

3. Write some basic source code in a .cpp file. In this case, I’m just using the code for printing hello world:

#include <iostream>

4. Compile with clang++ hello.cpp.

5. Run with ./a.out.