gpt4 book ai didi

c - preLaunchTask 'helloworld' 以退出代码 1 终止

转载 作者:太空宇宙 更新时间:2023-11-04 03:18:38 25 4
gpt4 key购买 nike

当我编译我的c文件时出现错误

(/""正在执行任务:g++ -g helloworld.c <

'g++' 不是内部或外部命令,可运行的程序或批处理文件。终端进程以退出代码终止:1

终端将被任务重用,按任意键关闭它。""/)

我的 launch.json 文件是

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": " C:/wamp/www/ShareIdea/helloworld.c/hello.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "C:\\Program Files (x86)\\mingw-w64\\i686-7.2.0-posix-dwarf-rt_v5-rev1\\mingw32\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "helloworld"
}



]
}

我的“tasks.json”文件是

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "helloworld",
"type": "shell",
"command": "g++",
"args": [
"-g",
"helloworld.c"
]
}

]
}

我已经将 c_cpp_properties.json 编辑为

       {
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}",
"C:/Program Files (x86)/mingw-w64/i686-7.2.0-win32-dwarf-rt_v5-rev1/mingw32/lib/gcc/i686-w64-mingw32/7.2.0/include/c++/tr1",
"C:/Program Files (x86)/mingw-w64/i686-7.2.0-win32-dwarf-rt_v5-rev1/mingw32/lib/gcc/i686-w64-mingw32/7.2.0/include/c++",
"C:/Program Files (x86)/mingw-w64/i686-7.2.0-win32-dwarf-rt_v5-rev1/mingw32/i686-w64-mingw32/include"
],
"defines": [
"_DEBUG",
"UNICODE"
],
"intelliSenseMode": "msvc-x64",
"browse": {
"path": [
"${workspaceRoot}",
"C:\\Program Files (x86)\\mingw-w64\\i686-7.2.0-win32-dwarf-rt_v5-rev1\\mingw32\\lib\\gcc\\i686-w64-mingw32\\7.2.0\\include\\c++",
"C:\\Program Files (x86)\\mingw-w64\\i686-7.2.0-win32-dwarf-rt_v5-rev1\\mingw32\\lib\\gcc\\i686-w64-mingw32\\7.2.0\\include\\ssp\\stdio",
"C:\\Program Files (x86)\\mingw-w64\\i686-7.2.0-win32-dwarf-rt_v5-rev1\\mingw32\\i686-w64-mingw32\\include"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 3
}

最佳答案

我已将 mingw-64 文件从“C:\Program Files (x86)”移动到“桌面”,并且我在 tasks.json 中指定了完整路径(即,(“命令”:C:\Users\varunteja\Desktop\mingw-w64\i686-7.2.0-win32-dwarf-rt_v5-rev1\mingw32\bin\g++",) 而不是 ("command": "g++",))。

而且我还编辑了“Launch.json”文件。在 Launch.json 文件中,我编辑了(“程序”:“C:/wamp/www/ShareIdea/helloworld.c/hello.exe”,)作为(“程序”:“C:/wamp/www/ShareIdea/a .exe",) 当我开始调试时创建了一个.exe文件。

我也将 cwd 更改为 ("cwd": "C:/wamp/www/ShareIdea",) 这是目标的工作目录

关于c - preLaunchTask 'helloworld' 以退出代码 1 终止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48792261/

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