VSCodeのインストール、vscodeコンパイラ、外部ヘッダ.hファイルを追加することvscode、vscode端子フラッシュバックしない、mingwの、vscode設定C ++

1.mingw POSIX SEH

链接:https://pan.baidu.com/s/1w_EIYDU7ro5TiseiBySmAA 
提取码:epi9

2.mingw環境変数を設定し
たフォルダの作成3.
4.vscode開口
新しいファイル.CPPを作成します。5.

#include <stdio.h>
#include <windows.h>
int main()
{
 printf("Hello World\n");
 system("pause");
 return 0;
}

6.F5
7.gdb、G ++
8注釈付きマウス配置
launch.json

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "g++.exe - 生成和调试活动文件",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "F:\\x86_64-8.1.0-release-posix-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "g++.exe build active file"
        }
    ]
}

task.json

{
// 有关 tasks.json 格式的文档,请参见
    // https://go.microsoft.com/fwlink/?LinkId=733558
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "g++.exe build active file",
            "command": "F:\\x86_64-8.1.0-release-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
            "args": [
                "-g",
                "${file}",
                "-I",//外部头文件
                "C:/Users/PH/Desktop/c++primer",//外部头文件
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "F:\\x86_64-8.1.0-release-posix-seh-rt_v6-rev0\\mingw64\\bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build"
        }
    ]
}

10.ctrl +シフト+ P、入力し"設定"
c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "C:/Users/PH/Desktop/c++primer"//外部头文件
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.18362.0",
            "compilerPath": "F:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",//C++标准
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 4
}

フラッシュバックない端末を変更し
Launch.jsonを

 "externalConsole": false,
公開された19元の記事 ウォンの賞賛0 ビュー1255

おすすめ

転載: blog.csdn.net/qq_35459198/article/details/105282530