英文:
VS Code launch: program does not exist
问题
这是我的文件 "test.c"
这是我的 launch.json:
这是我的 tasks.json:
我得到了这个错误消息。它说:“launch: program '<path to program except the path seprators are crossed out "W" characters>' does not exist”
你能告诉我我错在哪里吗?我已经安装了 C/C++ 扩展包、主题和 MinGW。
英文:
This is my file "test.c"
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_STACK_SIZE 100
typedef int Element;
Element data[MAX_STACK_SIZE];
int top;
void error(char str[]){
printf("%s\n",str);
exit(1);
}
void init_stack(){
top = -1;
}
int is_empty(){
return top==-1;
}
int is_full(){
return top == MAX_STACK_SIZE -1;
}
int size(){
return top +1;
}
void push(Element e){
if(is_full()){
error("스택 포화 에러");
data[++top] = e;
}
}
Element pop(){
if(is_empty()){
error("스택 공백 에러");
return data[top--];
}
}
Element peek(){
if(is_empty()){
error("스택 공백 에러");
return data[top];
}
}
void print_stack(char msg[]){
print("%s[%2d]", msg, size());
for(int i = 0; i<size(); i++){
printf("%2d", data[i]);
}
printf("\n");
}
int main(void){
init_stack();
for(int i = 1; i<10; i++){
push(i);
}
print_stack("스택 push 9회");
printf("\tpop() ---> %d\n", pop());
printf("\tpop() ---> %d\n", pop());
printf("\tpop() ---> %d\n", pop());
print_stack("스택 pop 3회");
return 0;
}
and this is my launch.json:
"version": "0.2.0",
"configurations": [
{
"name": "gcc.exe build active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "C:\\msys64\\mingw64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
and this is my tasks.json:
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe build active file",
"command": "C:\\msys64\\mingw64\\bin\\gcc.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
and I've got this error message. It says: "launch: program '<path to program except the path seprators are crossed out "W" characters>' does not exist"
Can you point me where I'm wrong? I have installed c/c++&extension pack, themes, MinGW also.
答案1
得分: 1
你需要实际运行你的构建任务。请参考命令面板中的任务: 运行任务
或任务: 运行构建任务
命令。
如果你想在启动配置之前自动运行构建任务,那么可以使用启动配置的preLaunchTask
字段(详见文档以获取更多信息)。
英文:
You have to actually run your build task. See the Tasks: Run Task
or Tasks: Run Build Task
commands in the command palette.
If you want the build task to be run automatically before starting the launch config, then use the launch config preLaunchTask
field (see the docs for more info).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论