c - 当我调试 C 程序时,我遇到了这个错误:PreLaunchTask 'C/C++:gcc.exe build active file' 以退出代码 -1 终止
问题描述
我是 C 编程的新手。我在调试时遇到了错误:(preLaunchTask 'C/C++:gcc.exe build active file' 以退出代码 -1 终止),如下所示:
我的launch.json是:
"version": "0.2.0",
"configurations": [
{
"name": "gcc.exe - 生成和调试活动文件",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: gcc.exe build active file"
}
]
}
我的tasks.json是:
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe build active file",
"command": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\gcc.exe",
"args": [
"-g",
"${workspaceFolder}\\*.c",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: \"C:\\Program Files\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\gcc.exe\""
}
]
}
解决方案
"程序": "${fileDirname}\${fileBasenameNoExtension}.exe",
您需要提供包含您的文件的目录名称,在
{fileDirname}
您需要在
{fileBasenameNoExtension}
推荐阅读
- c - 试图建立一个以字符串为条目的链表
- excel - Excel time changes to previous day after copy/pasting from an equation
- python - 用于从两端删除非 ASCII 字符的正则表达式
- python - 如何修复Tensorflow中的“ValueError:操作数无法与形状(2592,)(4,)一起广播”?
- apache-kafka - 在 micronaut 应用程序中嵌入 Kafka 找不到 bean
- java - 文字的定义(Java)
- python - 从解析树构建表达式树
- node.js - 为类似 Twitch.tv 的产品设置条带订阅
- pyspark - 返回满足一个条件的数据帧的行,同时修复另一列的值
- android - 即时应用 openGL 仅在 Android Pie 9.0.0 上呈现