Skip to content

Pre-configured profiles for effortless C/C++ development in VS Code

License

Notifications You must be signed in to change notification settings

xBLACKICEx/VSCppEase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VSCppEase: Out-of-the-Box C/C++ Development Environment for VS Code

Project Overview

VSCppEase aims to provide a simple, comprehensive C/C++ development environment for VS Code. By offering pre-configured profile files, users can avoid the hassle of manually installing extensions or adjusting complex settings. Simply download, import, and start developing immediately.

  • One-Click Setup: Provides ready-to-use VS Code configuration files, including extensions, settings, and keybindings. No longer need to manually install each extension or debug their environment—just import the profile and start coding.

  • Efficiency: Compilation, debugging, error checking, static analysis, testing, and package management are all streamlined.

Table of Contents

Installation

  1. Download Profile Files

    • Obtain the .code-profile from the profiles folder in the project repository.

    Certain plugins require additional utility software. Refer to Software Dependencies in the Error Checking and Linting section for more details.

  2. Import Profile

    • In VS Code, navigate to Settings icon > profile > profiles > New Profile> Import Profile..., select the downloaded profile, and import it.

    Avoid directly importing the base.code-profile settings, that could override global configurations. Refer to base_settings.jsonc for details.

When you are done switching profiles, you can ctrl + , to see the preset settings, (recommended to view via json formation)

Examples and Tutorials

  1. The following content is based on the gRPC_example project sample and the C-CPP BackEnd.code-profile extensions and settings.
  2. To build the gRPC_example, refer to the gRPC_example README.md.

The C-CPP BackEnd profile includes over 50 extensions (such as Copilot and YAML support), but here we’ll focus on core features like debugging, testing, and package management.

Most features are pre-configured (accessible via Ctrl + , to view settings). Additional configurations examples can be found in gRPC_example's .vscode folder.

Compilation & Debugging

Compilation

The CMake Tools extension is used for a Clion-like experience. By writing a CMakePresets.json file and selecting your configurations from the CMake toolbar, you can quickly compile your project.

Debugging Code

CMake Tools supports debugging via the left or bottom toolbar debug buttons. It relies on the C/C++ extension.

It is recommended to set ${command:cmake.launchTargetPath} in .vscode/launch.json to allow debugging previously selected CMake binaries with the F5 shortcut for greater flexibility. Refer to the launch.json file for details.

Debugging with CMake Extension

Debugging CMakeLists.txt

CMake Tools also supports debugging CMake itself. This feature is particularly useful for complex CMake configurations and variables.

Debugging CMakeLists

Extensions Required for Debugging

Full CMake Presets support requires CMake version 3.23 or above.

Error Checking and Linting

Error and standard compliance prompts rely on third-party tools.

Related Configuration:

Note: In some cases, the C/C++ and clangd extensions may not find the include paths, causing errors or auto-completion failures. You can manually configure these extensions, but it can be tedious. Since cmake supports generating compile_commands.json info, you can let the LSP extensions automatically identify dependencies. For details, refer to this CMakeLists.txt and c_cpp_properties.json. (No extra setup is needed for clangd it automatically looks for this file in the project root.)

Static Error Checking with cppcheck

Static Error Checking with cppcheck

Extensions Required for Code Analysis

Software Dependencies

  • clang, clangd, clang-tidy, and llvm-related software
  • cppcheck

Installation on Windows

  1. If you’ve installed Visual Studio’s C++ components, LLVM-related software is likely pre-installed at C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin\. You can add it to your PATH or start VS Code from the Developer PowerShellin terminal.

  2. Install via scoop install llvm cppcheck.

Recommended Tool: UnigetUI, a GUI for Windows package managers like scoop, chocolatey, winget, and cargo.

Installation on Linux

  • Ubuntu:
    • Install via sudo apt install -y clang clang-tidy (More Info)
    • Install via sudo apt install cppcheck.

Testing

CMake Tools supports CTest and automatically recompiles changed test code. For finer control, use the C++ TestMate extension, which supports Google Test and Catch2.

Testing and Visualizing Results

Extensions Required for Testing

Package Management

Conan

Dependency Display

Conan Extension Listing Dependencies

Quickly Configure Conan Environment

Details

Configuring Conan Environment

Extension Used: VSConan

Remember to configure the Conan path in settings!

Configuring VSConan Settings

vcpkg

Dependency Display

vcpkg Extension Listing Dependencies

Extension Used: Vcpkg CMake Tools

Others extensions

cxx refrence_img

C/C++ Config_img

Contribute

We welcome and appreciate your contributions to the project. If you have developed a useful profile or have suggestions for improvements, please consider sharing them with us. Your contributions can greatly benefit others by enhancing their development experience.

Thank you for your support!

About

Pre-configured profiles for effortless C/C++ development in VS Code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published