xcode 找不到 macOS 'wchar.h' 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26185978/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
macOS 'wchar.h' File Not Found
提问by ssell
Under OS X 10.9.5 using XCode 6.0.1 I am running into the following issue when I try to run make
from the terminal:
在使用 XCode 6.0.1 的 OS X 10.9.5 下,当我尝试make
从终端运行时遇到以下问题:
fatal error: 'wchar.h' file not found
This issue was not happening prior to a recent upgrade to Mavericks.
在最近升级到 Mavericks 之前没有发生此问题。
回答by ssell
First ensure that the latest XCode is installed. Next, we need to install/fix/update Command Line Tools. To do so, run
首先确保安装了最新的 XCode。接下来,我们需要安装/修复/更新命令行工具。为此,运行
xcode-select --install
Previously, XCode expected it's active developer directory to be located at
以前,XCode 期望它的活动开发人员目录位于
/Applications/Xcode.app/Contents/Developer/
but the latest Command Line Tools is installed to
但最新的命令行工具已安装到
/Library/Developer/CommandLineTools/
so we need to switch where XCode is looking. To do so, run
所以我们需要切换 XCode 的位置。为此,运行
sudo xcode-select --switch /Library/Developer/CommandLineTools/
And that should be it. These steps solved the issue for myself and two coworkers.
应该就是这样。这些步骤为我自己和两个同事解决了这个问题。
回答by Yupeng Tang
- My error was similar to yours which said string.h not found, I solved it by running this command:
- 我的错误与您的错误类似,它说没有找到 string.h,我通过运行以下命令解决了它:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
I think that the problem is that for macOS Mojave users, the headers are no longer installed under /usr/include by default.
我认为问题在于对于 macOS Mojave 用户,默认情况下不再将标头安装在 /usr/include 下。
回答by Josh
Adding on ssell's post and peter70's comment, I also still had issues after installing xcode command line tools again, and switching the xcode active developer directory. I was using CMake, and so deleted the debug/release folders which had existing Makefiles referencing out-of-date locations on Mojave. So for future problem resolving, after running the commands from ssell's post:
加上ssell的帖子和peter70的评论,我在再次安装xcode命令行工具并切换xcode活动开发者目录后仍然有问题。我正在使用 CMake,因此删除了 debug/release 文件夹,其中现有 Makefile 引用了 Mojave 上的过时位置。因此,为了将来解决问题,在运行 ssell 帖子中的命令后:
xcode-select --install
xcode-select --install
sudo xcode-select --switch /Library/Developer/CommandLineTools/
sudo xcode-select --switch /Library/Developer/CommandLineTools/
I believe if you've installed the command line tools by installing Xcode itself, you may also need to agree to the licence with sudo xcodebuild --license
. I don't think this is necessary if you used the prior xcode-select
command.
我相信如果您通过安装 Xcode 本身安装了命令行工具,您可能还需要同意sudo xcodebuild --license
. 如果您使用了先前的xcode-select
命令,我认为这没有必要。
Then also delete generated build scripts. If using CMake, delete the cmake-build-debug
and cmake-build-release
directories (your names may vary)
然后还要删除生成的构建脚本。如果使用 CMake,请删除cmake-build-debug
和cmake-build-release
目录(您的名字可能会有所不同)
回答by Alfredo Morales Pinzón
Deleting all the generated files and restarted the compilation worked for me. It was suggested in this link:
删除所有生成的文件并重新启动编译对我有用。在此链接中建议:
https://discourse.brew.sh/t/solved-scan-build-from-llvm-7-0-seems-broken-on-macos-mojave/3151/14
https://discourse.brew.sh/t/solved-scan-build-from-llvm-7-0-seems-broken-on-macos-mojave/3151/14
回答by yongyu wu
Deleting all the generated files, like @Alfredo Morales Pinzón. If you use cmake, so you need to delete the work dictionary which is "cmake-build-debug" and regenerated the "cmake-build-debug".
删除所有生成的文件,如@Alfredo Morales Pinzón。如果使用cmake,则需要删除“cmake-build-debug”工作字典,重新生成“cmake-build-debug”。
回答by voltento
Make sure, you update all symbols files which have references to the wchar
after updating xcode
. For me full cleaning build directory has worked
确保更新所有引用wchar
更新后的符号文件xcode
。对我来说,完全清理构建目录已经奏效