{"id":16110110,"url":"https://github.com/franneck94/vscode-c-cpp-runner","last_synced_at":"2025-04-10T02:29:05.272Z","repository":{"id":39811153,"uuid":"349713148","full_name":"franneck94/Vscode-C-Cpp-Runner","owner":"franneck94","description":"🚀 Compile, run and debug single or multiple C/C++ files with ease. 🚀","archived":false,"fork":false,"pushed_at":"2025-02-09T07:40:24.000Z","size":9846,"stargazers_count":60,"open_issues_count":14,"forks_count":17,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-02T21:45:27.344Z","etag":null,"topics":["clang","cpp","gcc","gdb","linux","lldb","macos","visual-studio-code","vscode","windows"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/franneck94.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-20T12:02:43.000Z","updated_at":"2025-03-30T20:38:47.000Z","dependencies_parsed_at":"2023-01-29T12:00:43.281Z","dependency_job_id":"7c8da346-0bc8-464a-9c75-12463cb55ce9","html_url":"https://github.com/franneck94/Vscode-C-Cpp-Runner","commit_stats":null,"previous_names":[],"tags_count":95,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franneck94%2FVscode-C-Cpp-Runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franneck94%2FVscode-C-Cpp-Runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franneck94%2FVscode-C-Cpp-Runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franneck94%2FVscode-C-Cpp-Runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/franneck94","download_url":"https://codeload.github.com/franneck94/Vscode-C-Cpp-Runner/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248143988,"owners_count":21054858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clang","cpp","gcc","gdb","linux","lldb","macos","visual-studio-code","vscode","windows"],"created_at":"2024-10-09T19:35:35.503Z","updated_at":"2025-04-10T02:29:05.241Z","avatar_url":"https://github.com/franneck94.png","language":"TypeScript","readme":"# VSCode C/C++ Runner\n\n🚀 Compile, run and debug [**single**](#compile-a-single-file) or [**multiple**](#compile-all-files-in-one-folder) C/C++/Cuda files with ease. 🚀  \nYou do not need to know about any compiler commands. 😎\n\n## Example\n\n![ExampleGif](./media/ExecuteTasks.gif?raw=true)\n\n## Software Requirements\n\n- 🔧 Any GCC, Clang, MSVC or Cuda NVCC compiler\n\nMake sure that your GCC/Clang compiler is either in your [PATH](https://superuser.com/a/284351) or you have to manually set the **C/C++ Compiler** setting of this extension.  \nFor Windows Users that want to use the [Visual Studio compiler](https://visualstudio.microsoft.com/) (called **MSVC**) see instructions [here](#using-the-msvc-compiler).  \nFor Cuda code the **NVCC** Compiler will be automatically called.\n\n## The Extension automatically activates when\n\n- There is a C/C++ file in the **root** directory of your workspace\n- You open a C/C++ file in your workspace\n\n## Compile a single file\n\n1️⃣ Open the C/C++ file you want to compile (build).  \n2️⃣ Select either debug or release mode for building the binary (debug is the default case).  \n3️⃣ To build the binary press **ctrl+alt+b**.  \n4️⃣ To run the binary press **ctrl+alt+r**, or you can click on the play icon in the status bar down below.  \n5️⃣ To debug the binary press **ctrl+alt+d**, or you can click on the bug icon in the status bar down below.  \n\n## Compile all files in one folder\n\n1️⃣ Select the folder that contains the C/C++ files you want to compile.  \nYou can select the folder by the quick pick menu from the status bar.  \n![TaskStatusBar](./media/FolderStatusBar.png)  \n2️⃣ Optional: Select either debug or release mode for building the binary (debug is the default case).  \n![TaskStatusBar](./media/ModeStatusBar.png)  \n3️⃣ Now you can build/run/debug the binary.  \n![TaskStatusBar](./media/TaskStatusBar.png)\n\n- ⚙️ Build: This task will compile all C/C++ files in the selected folder and will link them into a binary.  \n- ▶️ Run*: This task will execute the built binary.  \n- 🗑️ Clean*: This helper task will delete all files in the build dir.\n- 🐞 Debug*: This task will start a debugging session for the binary.  \n\n*This task is a no-op if the build task was not executed previously.\n\n## Basic Features\n\n### Configuration\n\nThe configuration settings will be stored **locally** in *\".vscode/settings.json\"*.  \n![FoundCompiler](./media/Settings.png)  \n\nBased on that, the local *\".vscode/c_cpp_properties.json\"* file is created.  \nIt will be used by [Microsoft's *C/C++*](https://code.visualstudio.com/docs/cpp/c-cpp-properties-schema-reference) extension for intellisense (auto-completion etc.).  \nNote: You **don't** have to edit the **c_cpp_properties.json** file.  \n\n### Basic settings\n\n- ⚙️ C Compiler Path (string, defaults to \\\"gcc\\\")\n- ⚙️ C Standard (string, defaults to the compiler's default, e.g. \"c99\")\n- ⚙️ C++ Compiler Path (string, defaults to \\\"g++\\\")\n- ⚙️ C++ Standard (string, defaults to the compiler's default, e.g. \"c++20\")\n- ⚙️ Debugger Path (string, defaults to \\\"gdb\\\")\n- ⚙️ MSVC Batch Path (string, defaults to \\\"\\\")\n- ⚙️ Use MSVC (boolean, defaults to false)\n- ⚙️ To enable Compiler Warnings (boolean, defaults to True)\n- ⚙️ GCC/Clang [Compiler Warnings](https://clang.llvm.org/docs/DiagnosticsReference.html) (string array, e.g. \"-Wall\")\n- ⚙️ MSVC [Compiler Warnings](https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warnings-by-compiler-version?view=msvc-170) (string array, e.g. \"\\W4\")\n- ⚙️ To treat Warnings as Errors (boolean, defaults to False)\n- ⚙️ To disable MSVC Security Warnings (boolean, defaults to False)\n\n## Using the MSVC Compiler\n\nTo use the **Visual Studio MSVC** compiler, e.g. VS2022, set the **msvcBatchPath** setting to a valid path.  \nAs an example installation path of the compiler:  \n**\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvarsall.bat\"**.  \nThen set the **useMsvc** extension setting to true, to use MSVC and not GCC/Clang.  \nIf you want to stop using the MSVC compiler, just set **useMsvc** to false.  \n⚠️ Only the 64-bit (no cross-compiling) version of MSVC is supported.  \n⚠️ The extension is only tested for VS2019 and VS2022.  \n⚠️ For auto detecting the installed VS you have to install it in **C:/Program Files/Microsoft Visual Studio**\n\n## Advanced Features\n\n### Passing Commandline Arguments\n\nYou can pass in command-line arguments for running or debugging the binary.  \n\n![Alt text](./media/cmdArgs.png)\n\nMake sure to select the active folder that should be compiled beforehand.  \nThen press `ctrl+alt+a` to open the message box to type in the arguments:\n\n![Arguments](./media/arguments.png)\n\nThese arguments will be stored in the launch.json config for debugging the binary.  \n\n![ArgumentsDebug](./media/argumentsDebug.png)\n\nIf you now run or debug your program these values will be fed into **argc**/**argv**.  \nImportant: The stored arguments will be reset after selecting a new active folder.  \nNote: For strings with whitespaces please use \\\" (not single \\').\n\n### Include \u0026 Exclude Folders for Selection\n\nYou can add [glob](https://en.wikipedia.org/wiki/Glob_(programming)#Syntax) patterns to include and exclude folders from the folder selection.  \nNote: The include pattern is used before the exclude pattern.\n\nFor example with the following exclude glob pattern:\n\n![ExcludePattern](./media/excludePattern.png)\n\nThe folder selection would change from left to right.\n\n![ExcludePaths1](./media/excludePaths1.png)\n![ExcludePaths2](./media/excludePaths2.png)\n\n### Generate Assembler Code\n\nWhen executing the command: **Generate Assembler Code**.  \nThe assembler code will be generated in a **.s** file that will be in the build directory next to the executable.  \n👷🏻 Note: Currently, this feature is experimental and only works for single-file builds.  \n\n### Advanced Settings\n\n- **If** the compiler has it implemented and only in **debug build**\n  - ⚙️ Activate the [address sanitizer](https://clang.llvm.org/docs/AddressSanitizer.html)\n  - ⚙️ Activate the [undefined sanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html)\n  - ⚙️ Activate the [leak sanitizer](https://clang.llvm.org/docs/LeakSanitizer.html)\n- ⚙️ Show detailed Information about the Compilation Time\n- ⚙️ Use link time optimization for release builds\n- ⚙️ Compiler Arguments (string array, e.g. **\\[\\\"-pthreads\\\"\\]**)\n- ⚙️ Linker Arguments (string array, e.g. **\\[\\\"-lpthread\\\"\\]**).\n  - Note: It is **expected** to prefix the arguments with the appropriate flags (e.g. -l or -L for GCC/Clang)\n- ⚙️ Include Paths (string array, e.g. **\\[\\\"path/to/headers/\\\"\\]**)\n  - Note: It is **not (!) expected** to prefix the arguments with the **-I** or **/I** flag\n- ⚙️ Include Glob Pattern for the Folder Selection (string array, defaults to **[\"\\*\", \"\\*\\*/\\*\"]**)\n- ⚙️ Exclude Glob Pattern for the Folder Selection (string array, defaults to **[\"\\*\\*/build\", \"\\*\\*/.\\*\", \"\\*\\*/.vscode\",]**)\n\n## Important Notes\n\n### Constraints with Files and Folders\n\n- 📝 File extensions for headers: \\*.h, \\*.hpp, \\*.hh, \\*.hxx\n- 📝 File extensions for sources: \\*.c, \\*.cpp, \\*.cc, \\*.cxx\n- ⚠️ Include paths and file names with whitespaces and special characters (e.g. \u0026) can make the compilation fail\n\n### CMake Projects in the Workspace Directory\n\nThe extension buttons are hidden if there is a CMakeLists.txt in the workspace root directory.  \nThis prevents an overloaded status bar with a lot of icons due to Microsoft's CMake extension.  \nHowever, the user can trigger the start-up of this extension by executing the command: **Toggle extension buttons in status bar**.\n\n## Release Notes\n\nRefer to the [CHANGELOG](CHANGELOG.md).\n\n## License\n\nCopyright (C) 2021-2023 Jan Schaffranek.  \nLicensed under the [MIT License](LICENSE).\n\n## Supporting the Work\n\nFeel free to donate, such that I have more time to work on my VSCode extension*s*.\n\n![PayPal QR Code](./media/QR-Code.png)\n\nOr use the Link: \u003chttps://www.paypal.com/donate/?hosted_button_id=3WDK6ET99ZQCU\u003e\n","funding_links":["https://www.paypal.com/donate/?hosted_button_id=3WDK6ET99ZQCU"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranneck94%2Fvscode-c-cpp-runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffranneck94%2Fvscode-c-cpp-runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranneck94%2Fvscode-c-cpp-runner/lists"}