Overview of the toy repository - Thoemi09/moderncpp_vscode GitHub Wiki
In the rest of this tutorial, we work with the toy repository moderncpp_vscode.
Set up the repo
We first create our workspace folder moderncpp_vscode
and then clone the GitHub repo into the source folder moderncpp_vscode.src
:
mkdir moderncpp_vscode && cd moderncpp_vscode
git clone https://github.com/Thoemi09/moderncpp_vscode.git moderncpp_vscode.src
Then we open the workspace folder in VS Code by using >File: Open Folder...
and selecting the folder moderncpp_vscode
which
we created above:
Note: Our workspace folder (opened in VS Code) is not the same as the source folder.
Overview of the repo
The toy repository contains a small linear algebra library linalg based on nda. Although it is kept very simple, it has a more or less standard project structure (all paths are relative to the source folder):
./CMakeLists.txt
: Top levelCMakeLists.txt
file../include
: Header files of the library../src
: Source files of the library../tests
: Unit tests based on googletest../examples
: Simple examples that use the library../deps
: Fetches the dependencies nda and googletest.
The other files ./.clang-format
and ./.clang-tidy
will be explained along the way.
The ./vscode
folder contains VS Code specific files used in this tutorial.
Syntax highlighting
If you open the file ./src/linalg.cpp
, you should see that VS Code supports basic syntax highlighting for C++:
This is not the case for CMake files:
In the bottom right corner, it says Plain Text
. That means VS Code treats the file as a plain text file.
To fix this problem, we will install (enable) our first extension: CMake