该程序&#c; \ ... \ a.exe'已退出代码0(0x00000000)

时间:2017-11-24 13:25:38

标签: c json visual-studio-code

我是vscode编辑器的新手,我想像下面那样运行简单的C项目,但是当我运行时,这个调试控制台如下所示。我想知道如何以正确的方式运行。

Type "apropos word" to search for commands related to "word".
=cmd-param-changed,param="pagination",value="off"
[New Thread 3076.0x2314]
[New Thread 3076.0x20c4]
Thread 1 hit Breakpoint 1, 0x00401603 in main ()
[Thread 3076.0x20c4 exited with code 0]
[Inferior 1 (process 3076) exited normally]
The program 'c:\Users\Lenovo\Desktop\Example\a.exe' has exited with code 0 (0x00000000).

(这是test.c文件)

#include <stdio.h>

int main()
{
    printf("hellow world");
    return 0;

}

我配置了tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "build Hello"
        }
    ]   
}

这是我配置的launch.json代码:

{    
"version": "0.2.0",
"configurations": [
    {
        "name": "(gdb) Launch",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceFolder}/a.exe",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": true,
        "MIMode": "gdb",
        "miDebuggerPath": "C:/MinGW/bin/gdb.exe",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ]
    }
]

}

这是我的c_cpp_properties.json文件:

{
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/test.c",
                "C:/MinGW/lib/gcc/i686-w64-mingw32/7.2.0/include/c++",
                "C:/MinGW/lib/gcc/i686-w64-mingw32/7.2.0/include/c++//tr1",
                "C:/MinGW/lib/gcc/i686-w64-mingw32/7.2.0/include/c++/i686-w64-mingw32"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE"
            ],
            "intelliSenseMode": "msvc-x64",
            "browse": {
                "path": [
                    "${workspaceFolder}/test.c",
                    "C:/MinGW/lib/gcc/i686-w64-mingw32/7.2.0/include/c++",
                    "C:/MinGW/lib/gcc/i686-w64-mingw32/7.2.0/include/c++//tr1"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        }

1 个答案:

答案 0 :(得分:1)

它只是想告诉你一切都很顺利。返回值0是&#34;没有错误&#34;。

你输了#34;你好&#34;但是,尾随&#34; w&#34;不应该在那里。

main()的参数应为(void)(int argc, char *argv[])