gpt4 book ai didi

c - 程序 'c:\...\a.exe' 已退出,代码为 0 (0x00000000)

转载 作者:行者123 更新时间:2023-11-30 20:20:06 24 4
gpt4 key购买 nike

我是 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": ""
}
}

最佳答案

它只是想告诉你一切都很顺利。返回值 0 表示“无错误”。

不过,“hello”中有一个拼写错误,后面的“w”不应该出现。

并且 main() 的参数应该是 (void)(int argc, char *argv[])

关于c - 程序 'c:\...\a.exe' 已退出,代码为 0 (0x00000000),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47474290/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com