- VScode Debug configuration (
lauch.jsonandtaks.json) .clang-formatto specify rules for how your code should be formatted, such as indentation, line length, spacing, and so on. It is based on a predefined style to base the formatting on (in my case, I use the Google style).
Last active
May 31, 2025 04:20
-
-
Save tapyu/8bced1527e3fdc89e6ab7f4023643000 to your computer and use it in GitHub Desktop.
C/C++-related files for development in Vscode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Language: Cpp | |
| BasedOnStyle: Google | |
| AllowShortBlocksOnASingleLine: Empty | |
| AllowShortFunctionsOnASingleLine: Empty | |
| AllowShortIfStatementsOnASingleLine: false | |
| AllowShortLoopsOnASingleLine: false | |
| AlignTrailingComments: true | |
| ColumnLimit: 80 | |
| DerivePointerAlignment: false | |
| LambdaBodyIndentation: OuterScope |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // file is specific to the C/C++ extension for VS Code. It is used | |
| // to configure settings related to | |
| // - IntelliSense, | |
| // - including include paths and code navigation | |
| // - compiler path | |
| // - and other language-specific settings. | |
| // It is primarily focused on setting up the environment for editing | |
| // and understanding the code, rather than building or debugging it. | |
| // NOTE: https://code.visualstudio.com/docs/cpp/c-cpp-properties-schema-reference | |
| { | |
| "configurations": [ | |
| { | |
| "name": "My_C/C++_Linux_cfg", // used to differentiate between multiple configurations within a single project or workspace. If you have only one, this doens't make a relevant differece. You can see which config is select in the status bar | |
| "includePath": [ | |
| "${workspaceFolder}/**", // An include path is a folder that contains header files | |
| "/usr/include", // (such as `#include "myHeaderFile.h"`) that are included | |
| "/usr/include/poppler" // in a source file. Add other paths here | |
| ], | |
| "defines": [], // used to set preprocessor macros that will be applied during IntelliSense parsing. This helps the C/C++ extension understand your code better and provide accurate code completion, navigation, and error checking (?) | |
| "compilerPath": "/usr/bin/g++", // (optional) The full path to the compiler you use to build your project | |
| "cStandard": "c11", | |
| "cppStandard": "c++17", | |
| "intelliSenseMode": "gcc-x64" | |
| } | |
| ], | |
| "version": 4 // don't edit this field. It tracks the current version. If it is wrongly changed or deleted, this file is overwritten with a minimal snippet configuration whenever it is saved | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // used to define debugging configurations. These configurations | |
| // specify how the debugger should launch and interact with your | |
| // application. Each configuration includes settings for the | |
| // debugger type, the program to debug, and any arguments or | |
| // environment variables needed. | |
| { | |
| "version": "0.2.0", | |
| "configurations": [ | |
| { | |
| "name": "C/C++ debug in Vscode", // configures how VS Code will launch the debugger for your application | |
| "type": "cppdbg", | |
| "request": "launch", // Specifies the type of request. launch means to start a new debug session. | |
| "program": "${workspaceFolder}/main", //path to your program | |
| "args": [], // array of command-line arguments to pass to the program when it starts | |
| "stopAtEntry": false, | |
| "cwd": "${workspaceFolder}", // current directory where the program in launch | |
| "environment": [], // array of environment variables to set for the debug session | |
| "externalConsole": false, | |
| "MIMode": "gdb", | |
| "setupCommands": [ | |
| { | |
| "description": "Enable pretty-printing for gdb", | |
| "text": "-enable-pretty-printing", | |
| "ignoreFailures": true | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // The tasks.json file is used to define tasks that can be executed in VS Code. | |
| // These tasks can be anything from building your project to running tests or | |
| // cleaning up build artifacts. | |
| // You can execute tasks defined in tasks.json directly from the Command Palette | |
| // (Ctrl+Shift+P) by typing "Run Task" and selecting the task you want to | |
| // execute. For example, you can run the build task to compile your project. | |
| // This file defines a build task to compile your C/C++. If this task is the | |
| // default one, you can press `ctrl+shift+B` to run it | |
| { | |
| "version": "2.0.0", | |
| "tasks": [ | |
| { | |
| "label": "Build", | |
| "type": "shell", | |
| "command": "make", // it uses `make` as base to create your executable | |
| "group": { | |
| "kind": "build", | |
| "isDefault": true | |
| }, | |
| "problemMatcher": { | |
| "owner": "cpp", | |
| "fileLocation": ["relative", "${workspaceFolder}"], | |
| "pattern": { | |
| "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", | |
| "file": 1, | |
| "line": 2, | |
| "column": 3, | |
| "severity": 4, | |
| "message": 5 | |
| } | |
| } | |
| } | |
| ] | |
| } | |
| // NOTE: https://stackoverflow.com/questions/58581500/how-to-fix-debugger-in-vscode-if-you-have-makefile-project-on-c | |
| // See https://go.microsoft.com/fwlink/?LinkId=733558 | |
| // for the documentation about the tasks.json format |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment