我尝试使用 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/