0

当我使用代码运行器(即Ctrl + Alt + N)运行 C++ 文件或使用右图标运行文件时,仅在(终端)PowerShell 中运行。选择不同的配置文件后,它也会在 PowerShell 中运行。

"terminal.integrated.profiles.windows": {
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [],
            "icon": "terminal-cmd"
        },
        "Git Bash": {
            "source": "Git Bash"
        }
        
    },

    "terminal.integrated.defaultProfile.windows": "Command Prompt",  //command prompt or git bash)

当我使用上述设置修复它时,我收到一个错误:

 //The token '&&' is not a valid statement separator in this version.//

我的task.json设置:

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "C:\\MinGW\\bin\\g++.exe",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "compiler: C:\\MinGW\\bin\\g++.exe"
        }
    ]
}
4

0 回答 0