如何解决 macOS 编译丢失 C Header 文件

栏目: IOS · 发布时间: 6年前

内容简介:今天在 macOS 10.14 通过 brew 安装 libgit2 之后调用时提示提示关键原因是在于找不到 /usr/include 目录,然而安装 command-line tools 也不会自动帮你解决,而是需要在安装后再手动安装 /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg 才行。跟随这个解决方案也附带了

今天在 macOS 10.14 通过 brew 安装 libgit2 之后调用时提示提示 fatal error: 'time.h' file not found ,本以为是 brew 的问题自己去编译问题依然。 确认了 Xcode Command Line Tools 并且再次确认了 xcode-select -s /Applications/Xcode.app 之后还是这样,就连重启大法也不用之后, 在 Google 上检索换了好些关键词也没找到问题出在哪,索性把关键词继续模糊放大扩大范围,看到了 github 一个不知道是啥的项目看到有 'stdio.h.h' file not found 类似的 issue 终于找到了 解决答案

关键原因是在于找不到 /usr/include 目录,然而安装 command-line tools 也不会自动帮你解决,而是需要在安装后再手动安装 /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg 才行。

跟随这个解决方案也附带了 解释

From the latest Xcode 10 Beta 2 release notes.
The Command Line Tools package installs the macOS system headers inside the macOS SDK. Software that compiles with the installed tools will search for macOS headers at the standard include path: /Applications/Xcodebeta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.1 4.sdk/usr/include For legacy software that looks for the macOS headers in the base system under /usr/include, please install the package file located at: /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

以上所述就是小编给大家介绍的《如何解决 macOS 编译丢失 C Header 文件》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

零工经济

零工经济

Diane Mulcahy / 陈桂芳 / 中信出版集团股份有限公司 / 2017-11-1 / CNY 39.00

// 国内第一本讲述“零工经济”概念的图书! // 互联网时代,你的技能与兴趣可以与市场需求产生更佳的匹配! // 通过工作模式的转型,你的财务状况可以获得更多的灵活性与稳定性! 如果把当前的工作世界看作一把尺子,设想它一头是传统意义上由企业提供的职业阶梯,另一头是失业,那么两头之间范围广、种类多的工作选择便是零工经济。它包括咨询顾问、承接协定、兼职工作、临时工作、自由职业、个体......一起来看看 《零工经济》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具