本文介绍了找不到"wchar.h"文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道以下问题:​​找不到macOS'wchar.h'文件但这并没有帮助我.我尝试过重新安装xcode,重新安装命令行工具,重新启动系统. wchar.h文件到位,但是编译器无法找到它.我还能尝试什么?也许是与sysroot相关?有什么办法解决吗?

I know about this question: macOS 'wchar.h' File Not Foundbut it did not help me. I've tried reinstalling xcode, reinstalling command line tools, restarting the system. wchar.h file is in place, but the compiler does not manage to find it. What else could I try? Maybe it is sysroot related? Any way to fix that?

macbooks-MacBook-Pro:Rack euphorbium$ sudo make
c++ -Iinclude -Idep/include -Idep/lib/libzip/include -DVERSION=dev -MMD -O3 -march=core2 -ffast-math -g -Wall -DARCH_MAC -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -DAPPLE -stdlib=libc++ -std=c++11 -stdlib=libc++ -c -o build/src/app.cpp.o src/app.cpp
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk' [-Wmissing-sysroot]
In file included from src/app.cpp:1:
In file included from include/app.hpp:2:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/vector:265:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/iosfwd:90:
/Library/Developer/CommandLineTools/usr/include/c++/v1/wchar.h:119:15: fatal error:
      'wchar.h' file not found
#include_next <wchar.h>
              ^~~~~~~~~
1 error generated.
make: *** [build/src/app.cpp.o] Error 1

因为wchar.h同时存在于xcode应用程序和/Library/Developer/CommandLineTools中,所以我认为它在一些完全不相关的文件夹中查找它.

since wchar.h exists both in the xcode app, and in the /Library/Developer/CommandLineTools I think that it looks for it in some completely unrelated folder.

推荐答案

我遇到了同样的问题.我可以通过使用符号链接来修复它.这就是我做的:

I've got the same problem. I was able to fix it by using a symbolic link.This is what I made :

cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
sudo ln -s MacOSX.sdk MacOSX10.07.sdk

然后输入您的root密码.

Then enter your root password.

注意:您必须使用所需的sdk修改最后一行.

NB: you have to adapt the last line with required sdk.

这篇关于找不到"wchar.h"文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!