Skip to content

Commit eea9793

Browse files
committed
update
1 parent edb229c commit eea9793

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
5151

5252
- [算法](#算法)
5353
- [Android](#android)
54+
- [C](#c)
5455
- [计算机](#计算机)
5556
- [设计](#设计)
5657
- [Docker](#docker)
@@ -118,6 +119,12 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
118119

119120
[`⬆ 返回目录`](#toc)
120121

122+
## C
123+
124+
- [在 MacOS 中找不到 C 程序的标准头文件](c/std-library-not-found-in-macos.md)
125+
126+
[`⬆ 返回目录`](#toc)
127+
121128
## 计算机
122129

123130
记录与计算机硬件相关的知识。

c/std-library-not-found-in-macos.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# 在 MacOS 中找不到 C 程序的标准头文件
2+
3+
比如 stdio.h,在 MacOS 中编译会报错找不到该文件。
4+
5+
这是因为在 Linux 系统里标准头文件默认放在 `/usr/include`,但 MacOS 里没有这个目录。
6+
7+
## 解决方法
8+
9+
1. 安装 [Xcode](https://developer.apple.com/xcode/)
10+
2.~/.bashrc 文件中设置环境变量:
11+
12+
```sh
13+
MACOSX_SDK="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
14+
export LIBRARY_PATH="$MACOSX_SDK/usr/lib"
15+
export CPATH="$MACOSX_SDK/usr/include"
16+
```

0 commit comments

Comments
 (0)