Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Configuration method of C language Compiler Environment in vscode

Shulou Source: shulou.com Published: 2022-06-02 14:29:26 10月04日 Update

Editor to share with you the configuration of the C language compilation environment in vscode, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Environment configuration of vscode c language

For a complete tutorial, please see this tutorial: https://blog.csdn.net/qq_43041976/article/details/100542557

Use the configuration file of the default installation directory of the MinGW-W64 GCC-8.1.0 compiler

MinGW-W64 GCC download address: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe

Offline download address: https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/

Launch.json

{"version": "0.2.0", "configurations": [{"name": "(gdb) Launch", / / configuration name, "type": "cppdbg", / / configuration type will be displayed in the launch configuration drop-down menu. Here only cppdbg "request": "launch", / / request configuration type Can be launch (startup) or attach (additional) "program": "${workspaceFolder} / ${fileBasenameNoExtension} .exe", / / the path of the program to be debugged is "args": [], / / the command line argument passed to the program when debugging is generally set to "stopAtEntry": false, / / when the program is set to true, the program will be paused at the entrance of the program It is generally set to false "cwd": "${workspaceFolder}", / / the working directory when debugging the program. Generally, it is ${workspaceRoot}, that is, the directory where the code is located. WorkspaceRoot has been deprecated. It is now changed to workspaceFolder "environment": [], "externalConsole": true, / / whether the console window is displayed when debugging. Generally set to the path of true display console "MIMode": "gdb", "miDebuggerPath": "C:/Program Files (x86) / mingw64/bin/gdb.exe", / / miDebugger. Note that it corresponds to the path of "preLaunchTask": "gcc", / / the task executed before the start of the debugging session, which is generally a compiler. C++ is gcc setupCommands: [{"description": "Enable pretty-printing for gdb", "text": "- enable-pretty-printing", "ignoreFailures": false}]}]}

Tasks.json

{"version": "2.0.0", "command": "gcc", "args": ["- g", "${file}", "- o", "${fileBasenameNoExtension} .exe"]} above are all the contents of the article "how to configure the C language compilation environment in vscode". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Configuration programs compilers environments languages directories articles paths methods content addresses consoles tutorials types controls compilers not much code tasks portals Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft MySQL Shulou Technology Linux Redmi