添加参数指定即可:
"-fexec-charset=gbk"
使用vscode里面是通过tasks.json里面定义逻辑的,下面给出windows环境的完整文件
{
"tasks": [
{
"type": "shell",
"label": "gcc.exe build active file",
"command": "C:\\mingw64\\bin\\gcc.exe",
"args": [
"-g",
"${file}",
"-fexec-charset=gbk"
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "C:\\mingw64\\bin"
}
}
],
"version": "2.0.0"
}