This lets us generate a compile_commands.json file that contains header files, which are missing from the cmake output.
pip install compdb
2. Run cmake and compdb
cd src
cmake -S . -B ../build
compdb -p ../build list > compile_commands.json
After running this, the src/compile_commands.json file should have been generated, which the Clangd language server needs for finding header files and other validation stuff.
3. VS Code extensions
I use VS Code, so I can only help with getting that set up.
In most cases, you'll only need the clangd language server extension. It should work out of the box.
If you plan to add to the CMakeLists.txt file you downloaded earlier, you'll want the CMake extension for syntax highlighting and cmake-format for automatic formatting.
There's probably a better place for this, but I'll put it here so anyone who is looking can find it.
Note: Android, Windows, and Linux targets have not been added yet.
1. Download the CMakeLists.txt file
2. Install compdb
This lets us generate a
compile_commands.json
file that contains header files, which are missing from the cmake output.2. Run cmake and compdb
After running this, the
src/compile_commands.json
file should have been generated, which the Clangd language server needs for finding header files and other validation stuff.3. VS Code extensions
I use VS Code, so I can only help with getting that set up.
In most cases, you'll only need the clangd language server extension. It should work out of the box.
If you plan to add to the CMakeLists.txt file you downloaded earlier, you'll want the CMake extension for syntax highlighting and cmake-format for automatic formatting.