VS code 调试C语言代码

我用VS code 学习C语言,想打印出 Hello World,可是调试之后出现了一个.exe 文件,那个黑色窗口也没有显示出来.
打开.exe文件后出现乱码, 有没有大佬帮我看一下?

这是hello.exe出现乱码
图片说明

这是launch.json 文件代码

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "gcc.exe build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "D:\\MinGW\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "gcc.exe build active file"
        }
    ]
}

这是tasks.json文件代码

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558 
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "gcc.exe build active file",
            "command": "D:\\MinGW\\bin\\gcc.exe",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "D:\\MinGW\\bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build"
        }
    ]
}

我的电脑已经装好了C/C++插件和 run code插件, 以及相应的MinGW, 但是运行的时候那个黑窗窗出不来, 运行后又出现了.exe 文件, 却是乱码.

添加系统环境path变量MinGW的bin文件夹,run code 不需要 任何启动配置。切到 .c 文件 点击右上角三角形就可以了。

图片说明

图片说明

如果系统是x86或x64,选择"x86_64", 否则选择"i868"。

posix: 启用 c++11多线程功能。

win32: 没有C++11多线程功能

#include <stdio.h> 
void main()
{ 
printf('hello world \n');
getchar();
}

改一下代码试一下,添加一行" getchar(); " ,意思是等待输入字符。

是不是在json里输入中文编码的问题