VSCODE 调试C程序时 打印中文

**1.**TASK.JSON :

"-fexec-charset=GBK", // 设置执行字符集为 GBK

"-finput-charset=UTF-8", // 输入字符集为 UTF-8

2.

int main()

{

SetConsoleOutputCP(6501); //必须加这一行。

}

cpp 复制代码
{

    "version": "2.0.0",

    "tasks": [

        {

            "label": "Compile with GCC",

            "type": "shell",

            "command": "gcc",

            "args": [

                "-g",

                "${file}",

                "-o",

                "${fileDirname}\\${fileBasenameNoExtension}.exe"

            ],

            "group": {

                "kind": "build",

                "isDefault": false

            },

            "problemMatcher": [

                "$gcc"

            ]

        },

        {

            "type": "cppbuild",

            "label": "C/C++: gcc.exe 生成活动文件",

            "command": "E:\\msys64\\ucrt64\\bin\\gcc.exe",

            "args": [

                "-fexec-charset=GBK",  // 设置执行字符集为 GBK

                "-finput-charset=UTF-8",  // 输入字符集为 UTF-8

                "-fdiagnostics-color=always",

                "-g",

                "${file}",

                "-o",

                "${fileDirname}\\${fileBasenameNoExtension}.exe"

            ],

            "options": {

                "cwd": "${fileDirname}"

            },

            "problemMatcher": [

                "$gcc"

            ],

            "group": {

                "kind": "build",

                "isDefault": true

            },

            "detail": "调试器生成的任务。"

        }

    ]

}
相关推荐
BD_Marathon3 天前
安装Jupyter notebook
ide·python·jupyter
讓丄帝愛伱4 天前
Zed Markdown 预览不能铺满全屏的原因及解决
ide
FungLeo4 天前
FengCMS · PHP+MySQL 升级实录 · 编辑器迁移:KindEditor → wangEditor5 +服务端 HTML Purifier
mysql·编辑器·php·富文本编辑器·fengcms
BD_Marathon4 天前
Jupyter魔法命令
ide·python·jupyter
郝学胜-神的一滴5 天前
Effective STL 条款 07:指针容器销毁前先删除
开发语言·c++·vscode·leetcode·rpc·visual studio
aaaameliaaa5 天前
VSCode的安装与配置
ide·笔记·vscode·编辑器
Star(up up up)6 天前
MySQL 事务隔离级别是如何实现的?从 MVCC 到锁机制原理详解
笔记·vscode·sql·学习·程序人生·mysql·学习方法
ScilogyHunter7 天前
[14] TMS570LC4357_VIM向量中断:128 通道、双 VIM 与硬件向量分发
单片机·编辑器·vim·excel·hercules·tms570
宝桥南山8 天前
Visual Studio 2026新特性 - 可以直接连接DeepSeek(使用Custom Endpoint Provider配置项)
ide·microsoft·微软·aigc·.net·visual studio
wangqiaowq8 天前
Protégé 开源本体(Ontology)编辑器
编辑器