体系结构的未定义符号 x86_64 VSCode 错误

Undefined symbols for architecture x86_64 VSCode error

我正在尝试修复以下 C 程序中的错误,我在 VSCode 中进入终端?

#include <stdio.h>

main()
{
    printf("just one small step for coders.one giant leap for\n");
    printf("programmers\n");
    return 0;
}

以下是我在 VSCode 终端编译时遇到的错误:

Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

尝试将 return 主函数的数据类型

int main(){

也许这不是解决方案,但这是我想到的唯一原因。

你缺少包含,这段代码 运行 对我来说,如果你一切正常,它应该 运行 对你来说:

#include<stdio.h>
#include<stdlib.h>
int main()
{
    printf("just one small step for coders.one giant leap for\n");
    printf("programmers\n");
    return 0;
}