首页 > 解决方案 > 在 Mac Mojave 上运行简单的 hello world 时出现链接器错误

问题描述

我收到以下链接器错误:

来源(hello_world.c):

#include <stdio.h>

int main(){
   printf("hello world\n");
   return 0;
}

汇编:

$ gcc hello_world.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)
$

标签: cmacos

解决方案


推荐阅读