CS50 IDE clang:错误:链接器命令失败,退出代码 1

发布于 2025-01-16 07:32:28 字数 468 浏览 3 评论 0原文

我正在从 CS50 学习 C 编程。我试图建立平价计划。这是我的代码,

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

int main (void)
{
    int n=get_int("n: ");
    if(n%2==0)
    printf("even\n");
    else
    printf("odd\n");
}

当我尝试编译时出现以下错误,

clang: error: linker command failed with exit code 1 

有人能告诉我这里发生了什么吗?

我试图在官方 CS50 IDE 上编译它,但出现了错误。

这是我在 stackoverflow 上的第一个问题,所以如果我做了任何不好的格式或样式,请原谅我。

任何帮助将不胜感激。

I am learning C programming from CS50. I was trying to to build parity program. Here is my code,

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

int main (void)
{
    int n=get_int("n: ");
    if(n%2==0)
    printf("even\n");
    else
    printf("odd\n");
}

when I try to compile I get the following error,

clang: error: linker command failed with exit code 1 

Can anyone tell what's going on here?

I was trying to compile this on official CS50 IDE and I got that error .

This is my first question on stackoverflow, so pardon me if I am doing any bad formatting or styling.

Any help will be highly appreciated.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

王权女流氓 2025-01-23 07:32:28

我自己想出来的。有一个与我的 c 源文件同名的文件夹。这就是为什么 clang 感到困惑。

I figured it myself. There was a folder with same name as my c source file. That's why clang got confused.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文