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