File 'wchar.h' not found

I know about this question: macOS 'wchar.h' The file was not found but it did not help me. I tried reinstalling xcode, reinstalling command line tools by restarting the system. The wchar.h file is in place, but the compiler does not find it. What else could I try? Maybe this is due to sysroot? Any way to fix this?

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

since wchar.h exists both in the xcode application and in /Library/Developer/CommandLineTools, I think it is looking for it in some completely unrelated folder.

+6
source share
6 answers

I have the same problem. I was able to fix this with a symlink. Here is what I did:

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

Then enter your root password.

NB: SDK.

+7

macOS High Sierra. , , . CMake. CMake, " " "" . sysroot make, SDK, .

+13

, MacOSX Mojave, . :

  • open/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg Xcode.
  • sudo xcode-select -s/Library/Developer/CommandLineTools sudo xcode-select -s/Library/Developer/CommandLineTools
+3

sysroot ( mac os), make .

+2

- macOS Mojave, , :

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

- , ... , .

: c++ Homebrew MacBook ... Xcode CommandLineTools , /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg, "c++" /Library/Developer/CommandLineTools/usr/include/c++/v1 , , , /usr/local/Cellar/gcc/8.2.0/include/c++/8.2.0 .

The trick worked, because now the missing file "wchar.h" is where it should be ... Your settings probably don't match, however, I'm afraid.

-1
source

Source: https://habr.com/ru/post/1686123/


All Articles