A simple C project template configured with Clang and Make, featuring static analysis and code formatting support. Includes integration with Visual Studio Code for an enhanced development experience.
- Clang compiler
- clang-tidy (for static analysis)
- clang-format (for code formatting)
- make
- Visual Studio Code
- C/C++ VSCode extension
.
├── .clang-tidy # Clang-tidy configuration
├── .vscode/ # VSCode configuration files
├── Makefile # Build system configuration
├── hello_world.c # Sample C program
└── README.md # This file
You can build and run the project either through Make commands or VSCode:
-
Build the project:
make
-
Run the program:
./hello_world
-
Clean build artifacts:
make clean
-
Run static analysis:
make analyze
-
Format code:
make format
- Build: Press
F7or use Command Palette (Cmd+Shift+P) →Tasks: Run Build Task - Run/Debug: Press
F5to run with debugging - Format: Right-click in editor →
Format Documentor pressShift+Alt+F - Static Analysis: Problems panel will show clang-tidy warnings automatically
To use this template for your own project:
-
Rename or replace the sample file:
- Rename
hello_world.cto your preferred name - Update the
TARGETvariable in the Makefile to match your new filename - Update tasks in
.vscode/tasks.jsonif you renamed the main file
- Rename
-
Customize clang-tidy rules:
- Edit
.clang-tidyto adjust static analysis rules based on your project needs - VSCode will automatically use these rules for inline diagnostics
- Edit
-
Customize VSCode settings (optional):
.vscode/settings.json: Editor and language server settings.vscode/tasks.json: Build and analysis tasks.vscode/launch.json: Debug configurations
-
Update .gitignore:
- Add your new executable name to the
.gitignorefile if you renamed the project
- Add your new executable name to the
This template includes:
- clang-tidy configuration for static analysis (both command line and VSCode integration)
- clang-format for consistent code formatting (both command line and VSCode integration)
- Compiler warnings enabled (-Wall -Wextra -pedantic)
- VSCode IntelliSense for code navigation and inline error checking
Visual Studio Code provides several features when using this template:
- Syntax highlighting
- IntelliSense code completion
- Go to definition/references
- Inline error checking and static analysis
- Integrated debugging with lldb
- Task integration for building and analysis
- Source control integration
- Integrated terminal
This template is available under the MIT License.