gpt4 book ai didi

c - 编译 C 文件时未找到架构 x86_64 的符号

转载 作者:行者123 更新时间:2023-11-30 21:13:15 25 4
gpt4 key购买 nike

我尝试使用 Mac 终端运行 c 文件。所以我在终端中输入以下命令。

gcc main.c

并显示以下消息。

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)

在此之前,我也尝试过在Eclipse中构建C项目,但这也显示错误。它表示存在一个错误,即未找到架构 x86_64 的符号

最佳答案

您的程序缺少入口点(主函数),您必须将此函数添加到您的代码源中。

int main(void){
printf("Hello World");
}

关于c - 编译 C 文件时未找到架构 x86_64 的符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34407003/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com