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": "调试器生成的任务。"

        }

    ]

}
相关推荐
诚信定制8397 小时前
Typora:一款优雅的跨平台 Markdown 编辑器
编辑器
渣渣盟11 小时前
Linux软件管理与编辑器命令速查手册
linux·运维·编辑器
Tian_Hang1 天前
Eclipse Ditto 的权限策略
java·服务器·前端·网络·ide·ubuntu·eclipse
Tian_Hang1 天前
Eclipse Mosquitto 安装及介绍
java·运维·服务器·ide·sql·mysql·eclipse
星云_byto1 天前
五分钟从零配置好VSCode + Claude Code + DeepSeek V4 Pro
ide·vscode·编辑器·cursor·codex·claude code·deepseekv4
诚信定制8392 天前
Typora插件开发指南:打造专属IDE式写作环境
ide
Tian_Hang2 天前
Eclipse Ditto 物模型相关代码
java·运维·服务器·ide·eureka·eclipse
Tian_Hang2 天前
Eclipse Ditto 节流机制
java·ide·eclipse
DogDaoDao2 天前
AI 编程 IDE 全景解析 2026:Agent 全面接管开发链路
ide·人工智能·程序员·ai编程·claude·cursor·ai agent
你家人养牛2 天前
OOC Relation Plugin:C 语言面向对象 开发的高效辅助工具
c语言·vscode