MacOs环境下,安装第三方库时候出现fatal error: ‘stdexcept‘ file not found的解决方案

fatal error: 'stdexcept' file not found
#include <stdexcept>
             ^~~~~~~~~~~
    1 warning and 1 error generated.
    error: command 'gcc' failed with exit status 1

这个问题搜了好多没有合适的答案,

有一个说要安装命令行工具

Mac OS X中安装命令行工具Command Line Tools(无Xcode)

 参考http://railsapps.github.io/xcode-command-line-tools.html

安装

 xcode-select --install

但是比较慢,或者直接下载dmg安装包

Go to https://developer.apple.com/downloads/more and enter your Apple ID and password. You'll be asked to agree to the terms of the Apple Developer Program. You'll see a list of software packages you can download. Look for the latest version of Command Line Tools and click to download the .dmg file. Downloading the .dmg file is much faster than waiting for the command-line-based download. Install the .dmg file by clicking on the package icon.

验证:

$ xcode-select -p
/Library/Developer/CommandLineTools
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix

macOS Mojave/usr/include,默认情况下不再安装标头。

以下命令应解决此问题:

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

命令行工具
新功能

  • 命令行工具包在macOS SDK中安装macOS系统头文件。使用已安装工具编译的软件将在Xcode中搜索macOS SDK中的标题:

    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk 或Command行工具位于:/ Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

     

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值