终端进程以退出代码终止:1有什么办法可以解决?

时间:2019-11-10 12:39:00

标签: c++ visual-studio-code

我正在尝试在Visual Studio Code中编译基本的“ Hello World”代码。但是我是编码方面的新手,所以我不明白“以退出代码1终止的终端进程”的含义。

这是我的task.json:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "echo",
            "type": "shell",
            "command": "C:/MinGW/bin/g++",
            "args": [
                "-g", "main.cpp"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

这是c_cpp_properties.json文件:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceRoot}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "C:\\MinGW\\bin\\gcc.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "${workspaceRoot}/",
                     "C:\\MinGW\\lib\\gcc\\mingw32\\6.3.0\\include\\c++"

                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }

        }
    ],
    "version": 4
}

这是我要执行的程序:

#include <iostream>
using namespace std;
int main() 
{
    cout << "Hello, World!";
    return 0;
}

如何解决此问题?

1 个答案:

答案 0 :(得分:0)

如果遇到错误,则应在Google上搜索错误消息。 First hit,其归结为:VSCode找不到编译器。 VSCode只是一个IDE:它不随编译器一起提供。

阅读this page,了解如何设置VSCode与C ++一起使用。