c/c++语言开发共享vscode C++ 程序 windows

vscode 1.42.1 OS: windows 7 x64 1. vscode, cpp extension 本文直接跳过 vscode 安装, Cpp tools 安装 2. MinGw 安装及配置 下载 “MinGW Minimalist GNU for Windows” 安装过程 安装所需 …

vscode 1.42.1
os: windows 7 x64

1. vscode, cpp extension

c/c++开发分享vscode C++ 程序 windows直接跳过 vscode 安装, cpp tools 安装

vscode C++ 程序 windows

2. mingw 安装及配置

下载mingw – minimalist gnu for windows
vscode C++ 程序 windows

安装过程
vscode C++ 程序 windows

安装所需依赖环境
vscode C++ 程序 windows

3. 配置环境变量

vscode C++ 程序 windows

4. 调试

配置 launch.json

{     "version": "0.2.0",     "configurations": [         {             "name": "g++.exe build and debug active file",             "type": "cppdbg",             "request": "launch",             "program": "${filedirname}\${filebasenamenoextension}.exe",             "args": [],             "stopatentry": false,             "cwd": "${workspacefolder}",             "environment": [],             "externalconsole": true,  // 这里要改为true             "mimode": "gdb",             "midebuggerpath": "d:\mingw\bin\gdb.exe",             "setupcommands": [                 {                     "description": "enable pretty-printing for gdb",                     "text": "-enable-pretty-printing",                     "ignorefailures": true                 }             ],             "prelaunchtask": "g++"         }     ] }

配置task.json

{     "version": "2.0.0",     "tasks": [         {             "label": "g++",             "type": "shell",             "command": "d:\mingw\bin\g++.exe",             "args": [                 "-g",                 "${file}",                 "-o",                 "${filedirname}\${filebasenamenoextension}.exe"             ],                          "options": {                 "cwd": "d:\mingw\bin"             },                          "problemmatcher": [                 "$gcc"             ],              "presentation": {                 "echo": true,                 "reveal": "always",                 "focus": false,                 "panel": "new",                 "showreusemessage": true,  //这里shared表示共享,改成new之后每个进程创建新的端口                 "clear": false             }         }     ] }

最后结果

vscode C++ 程序 windows

参考

  1. 整理:visual studio code (vscode) 配置c、c++环境/编写运行c、c++(主要windows、简要linux)
  2. vscode 基本知识以及如何配置 c++ 环境
  3. 关于vscode报错“终端将被任务重用,按任意键关闭”的解决方案
  4. vscode 代码调试器
  5. windows 10上使用vscode编译运行和调试c/c++
    certainty of death. small chance of success.

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/c-cdevelopment/600209.html

(0)
上一篇 2021年5月9日
下一篇 2021年5月9日

精彩推荐