File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
51
51
52
52
- [ 算法] ( #算法 )
53
53
- [ Android] ( #android )
54
+ - [ C] ( #c )
54
55
- [ 计算机] ( #计算机 )
55
56
- [ 设计] ( #设计 )
56
57
- [ Docker] ( #docker )
@@ -118,6 +119,12 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
118
119
119
120
[ ` ⬆ 返回目录 ` ] ( #toc )
120
121
122
+ ## C
123
+
124
+ - [ 在 MacOS 中找不到 C 程序的标准头文件] ( c/std-library-not-found-in-macos.md )
125
+
126
+ [ ` ⬆ 返回目录 ` ] ( #toc )
127
+
121
128
## 计算机
122
129
123
130
记录与计算机硬件相关的知识。
Original file line number Diff line number Diff line change
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
+ ```
You can’t perform that action at this time.
0 commit comments