'wchar.h' file not found

For any one struggling with this on MacOSX Mojave this answer solves it. In short:

  • Go to the terminal and run open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg This will bring up the prompt to install Xcode tools.
  • After that's done got to the terminal and run sudo xcode-select -s /Library/Developer/CommandLineTools

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  

Then enter your root password.

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


I had the same problem after upgrading to macOS High Sierra. A project which was compiling before stopped working with this error. In my case, the project files had been generated by the CMake application. The solution was to run CMake, 'Delete Cache', and 'Configure' the project again. This corrected the sysroot directory reference in the make files to point to the new SDK and the error was resolved.

Tags:

C++

Ios

Xcode