One of the best parts about this module is it can be done on all 3 major operating systems. The goal of this document is to provide all relevant knowledge required to setup tooling for this module on Linux-based computers. Do note that all "optional" configurations listed here are totally optional and can be safely ignored.
First half of this course does not use any special package. All you need is a modern compiler.
On Ubuntu-based systems, the build-essential
package provides everything we need, which is a modern C++ compiler (gcc/g++) and make
for defining project build process.
sudo apt install build-essential
If you're using any other distribution you need to install GNU C/C++ Compiler
packages.
- Install Visual studio or VSCodium (MS-free version of VS Code).
- Install C/C++ extension to get code completion.
- Install
vim
orneovim
through your package manager. - Install Node.js LTS version.
- Install coc.nvim package with your preferred package manager. We recommend vim-plug.
- Install coc-clangd which provides clangd Language Server Protocol (LSP) integration in coc/vim.
- Create
Makefile
for your project. A make file defines your project dependencies and does the least possible amount of work required to compile your project: GNU Make documentation. - Install
clang-format
for autoformatting C++ files. Clang format uses a.clang-format
file in root for understanding your preferences. A sample file that follows code style in lectures is present here: amenat/dotfiles/.clang-format. You can configure "format on save" in VS Code from settings; or in Vim by adding C++ extensions tococ.preferences.formatOnSaveFiletypes
incoc-settings.json
. - Setup
cppcheck
andclang-tidy
for static analysis of your code. These tools help spot common errors. - Install
valgrind
for checking memory leaks. Ideally you should not be doing any memory management on your own at this stage. - Install
gdb
for debugging. - Install and use
git
. The git sections of REPL (YouTube, websites, courses) have lots of video suggestions and links for learning git.
-- work in progress --
General recommendation: If you're new to Linux, try the missing-semester series of lectures from MIT.
If you ever get stuck, post in #linux
Slack channel.