c - 在 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)
$
解决方案
推荐阅读
- angular - 在 Angular 5 中动态添加生命周期方法
- css - Vis.js 组背景样式
- html - 在不使用 100vh 的情况下强制 div 为整页高度
- gremlin - 顶点属性从 Gremlin 控制台更改,但不是从 Python 脚本更改
- raku - Perl6 cmp 两个字符串可以不区分大小写吗?
- c# - 单击第一个数据网格行不触发 selectedIndex 更改
- node.js - webpack-dev-server 不会在启动时创建初始包
- java - 在 java 8 流中将映射转换为更扁平的结构
- typescript - 带有 TypeScript 3.0 的 Visual Studio Code 1.25 变得非常慢
- javascript - 在深度优先遍历中理解 JavaScript 递归和调用栈