C中的C代码错误。 peraunchtask' c/c++:gcc.exe构建活动文件'用退出代码-1终止

发布于 2025-02-06 20:08:59 字数 1129 浏览 2 评论 0原文

我真的是C和VS代码的新手,当我尝试编译代码时遇到了此错误:

#include <cs50.h>
#include <stdio.h>

int main(void)
{
    string answer = get_string("What's your name? ");
    printf("hello, %s", answer);
} 

此错误出现,但是当我按“显示错误”时,它说我没有任何东西,当我按“无论如何”调试时,它显示

​/strong>:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "C/C++ Runner: Debug Session",
      "type": "cppdbg",
      "request": "launch",
      "args": [],
      "stopAtEntry": false,
      "externalConsole": true,
      "cwd": "c:/Users/Administrator/Desktop/CS50/lecture1",
      "program": "c:/Users/Administrator/Desktop/CS50/lecture1/build/Debug/outDebug",
      "MIMode": "gdb",
      "miDebuggerPath": "C:/msys64/mingw64/bin",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ]
    }
  ]
}

它只有在我安装CS50.H之后才开始出现,如果我尝试运行一个没有文件的文件,那就很好。

感谢任何帮助,谢谢!

I am really new to C and VS Code and came across this error when I try to compile the code:

#include <cs50.h>
#include <stdio.h>

int main(void)
{
    string answer = get_string("What's your name? ");
    printf("hello, %s", answer);
} 

This error shows up, but when I press "Show Errors" it says that I don't have any and when I press "Debug Anyway" it shows another one, saying that there is no such file as hello.c and sends me to launch.json

The launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "C/C++ Runner: Debug Session",
      "type": "cppdbg",
      "request": "launch",
      "args": [],
      "stopAtEntry": false,
      "externalConsole": true,
      "cwd": "c:/Users/Administrator/Desktop/CS50/lecture1",
      "program": "c:/Users/Administrator/Desktop/CS50/lecture1/build/Debug/outDebug",
      "MIMode": "gdb",
      "miDebuggerPath": "C:/msys64/mingw64/bin",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ]
    }
  ]
}

It only started appearing after I installed cs50.h and if I try to run a file without it, then it's fine.

I would appreciate any help, thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文