Install Clang and Visual Studio Code on Ubuntu
Clang is very easy to install. Open a terminal and issue this command:
sudo apt install clang
It takes a little bit more for Visual Studio Code (aka VS Code). Start on the download page of VS Code. Just google for download Visual Studio Code or click here. Click the Deb rectangle and pick the Open with Software install (default) and that will install it.
After that is installed, run VS Code (open a terminal and type code) and click the extensions icon (5th down on the left) and type in C++ in the search box. The first result is by Microsoft so select it and click install.
Now I created a Projects folder under my home, so click on open Folder in the File menu and select Projects. You can create individual folders for applications under that. If you look closely you can see Asteroids, AsteroidsDND and Examples with Asteroids being open and containing two .c files.
To compile, make sure the open tab is the file you wish to compile then click Terminal on the top menu and Run Build Task… You’ll see the compiled programs on the left under the Asteroids folder (decnot and ex1).
There’s a bit more for configuring Builds and Debugging but I’ll cover that another time.
Confession, I can program in C++ though I’m a bit rusty and my C++ knowledge stops short of creating template classes but I can use them. But given that probably most games these days are programmed in C++ why is this site about C?
My secret: is I use a piece of software called
If you have a bit of nesting and you want to make sure your braces match up, Visual Studio code (VSC) can help you with that.


There are four steps to do this. That’s assuming that you have successfully compiled your C or C++ program and have the source file handy.
In the chapter 42 of both e-books when the first collision detection is introduced, I added a SHOWOVERLAP #define. If this is uncommented, instead of things blowing up, it shows every pixel where two objects pixel’s overlap in bright green.