Wchar.h - file not found:

Hi when i try to compile for x64 Android device I receive this error:

LogPlayLevel: UnrealBuildTool: NDK version: 19, GccVersion: 4.8
LogPlayLevel: UnrealBuildTool: Compiling Native code with NDK API 'android-19'
LogPlayLevel: UnrealBuildTool: Performing 498 actions (4 in parallel)
LogPlayLevel: UnrealBuildTool: [1/498] clang++.exe EnginePrivate.h [x64-es31]
LogPlayLevel: UnrealBuildTool: [2/498] clang++.exe EnginePrivate.h [x64-es2]
LogPlayLevel: UnrealBuildTool: [4/498] clang++.exe RendererPrivate.h [x64-es31]
LogPlayLevel: UnrealBuildTool: [3/498] clang++.exe RendererPrivate.h [x64-es2]
LogPlayLevel: UnrealBuildTool: In file included from E:/Epic Games/Projects/MyProject/Intermediate/Build/Android/MyProject/Development/Engine/EnginePrivate.h:4:
LogPlayLevel: UnrealBuildTool: In file included from D:\UnrealEngine\Engine\Source\Runtime\Engine\Private\EnginePrivate.h:8:
LogPlayLevel: UnrealBuildTool: In file included from Runtime/CoreUObject/Public\CoreUObject.h:7:
LogPlayLevel: UnrealBuildTool: In file included from Runtime/Core/Public\Core.h:16:
LogPlayLevel: UnrealBuildTool: Runtime/Core/Public/HAL\PlatformIncludes.h(6,10) :  fatal error: 'wchar.h' file not found
LogPlayLevel: UnrealBuildTool: #include <wchar.h>

wchar.h is included by PlatformIncludes.h, which is compiled by Android NDK’s clang++(version 3.6). Clang++ is located in “android-ndk-r10e\toolchains\llvm-3.6\prebuilt\windows-x86_64\bin”. Its header files used for compiling are in “android-ndk-r10e\toolchains\llvm-3.6\prebuilt\windows-x86_64\lib\clang\3.6\include” and there is no wchar.h in the header files. I have tried to add the wchar file from g++, but i get errors for the content in wchar.h so that is not the solution. I’ve recently reinstalled UE4 and Android works so that shouldn’t be the problem.

Note:

If you first get an error that c++config.h, os_defines.h and cpu_defines.h are missing, you may want to add [these files][1] in “android-ndk-r10e\sources\cxx-stl\gnu-libstdc++\4.8\include\bits”.

PS:
When i start adding in the missing files one by one from cygwin to clang’s include folder there are new errors that start to appear from android-ndk/platforms/android-19’s header files, so copying files from cygwin to clang’s include folder is not an option, so i restored my original clang folder.

77008-files.rar (11 KB)

,

  1. Please delete your DerivedDataCache, Intermediate and Saved folders from your project folder. Once you’ve done that, attempt to package again.
  2. If that does not work for you, please create a brand new project in UE4 and attempt to package it, let me know if you happen to experience the same error or not.
  3. You can also attempt to migrate your whole project over to a newly created project and see if that overwrites the error you’re running in to.
  4. Last but not least, please send screenshots of your Android SDK from within the editor as well.

I’ve tried 1-3 a couple of times before i post this question, here is a screenshot - http://i.imgur.com/EihVCaE.jpg

Do you have an older version of this project? If so, does the same error occur or is this a new error? Also try to package for ETC1 and let me know if that works for you.

  • [AnswerHub - Error wchar.h file not found][1]
  • [AnswerHub - wchar.h file not found][2]

[Resolved] Can't build/package blank project for Android - Mobile - Epic Developer Community Forums
[2]: Compiling Android - fatal error : 'wchar.h' file not found - Mobile - Epic Developer Community Forums

This is not a new error, I’ve tried this with the GitHub version of UE, when it was 4.7 and the same error was occurring. As I said I’ve reinstalled AndroidWorks and UE. I’ve recently reinstalled my Windows so that won’t be the problem, and this error also occurs on other PCs, not only on mine. I’ve tried to package for ETC1 the same error occurs. If you try it i am 100% sure that you will face the same errors. If you don’t have x64 bit device you can just create a new AVD(Android Virtual Device).

I have created a code project for Android and launched it to my Android device without any wchar.h errors within the logs. I also packaged the project for ETC1, ETC2 and Android (All) without any trouble. I tested on both a and a Nvidia Shield Tablet.

  • Could you please attempt the suggestions from the AnswerHub posts I provided?
  • Do you have a sample project where this is replicated that you can share with me?
  • Do you know the exact reproduction steps to get this error to happen?

I’ve already tried the links you gave me and gave you the answer in my previous post. Here is how I receive this error: First I am creating a mobile project, maximum quality with starter content. Then I am configuring it for Android(I am clicking Configure now) and setting the min SDK Version 19 and Target 23. Then select all the tics for x86, x86_x64 and the other OpenGL version and just click launch on an x64 device. After this if I don’t add the files from the archive I’ve uploaded to the dir I said an error appears that they are missing, if they are there I get the error that wchar.h is missing and as I said it is really missing from android ndk’s clang. As I said I am using the last version of AndroidWorks, VS and UE. Could you tell me when did you cloned(downloaded) and compiled your Engine version, and what android ndk, sdk, ant, jdk versions did you used. Also could you please send me a log of successful compilation to ETC2/ETC1.

,

I have tested this and I’ve had another look into this as well. Neither of us were able to get the wchar.h error. I checked my computer for “wchar.h” specifically and found the files included in my GitHub build.

Could you please list out your exact steps on how you build your GitHub version of the engine? Could you also attach a small sample project where this is occurring? If it doesn’t fit in the attachment section, upload it to Drive or something similar and provide me with the download link.

Thanks!

Hey ,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you!

The said in my question is still occurring i am using UE release version 4.11 built from source. Here is the project that i am trying with - MEGA

Thank you for your patience. I still haven’t been able to replicate it however, I have found some additional suggestions that may resolve this issue:

  • Try packaging with ETC 1
  • [AnswerHub Suggestion][1]

I hope one of these will help fix what’s happening. Unfortunately, the other solutions I saw were to do a full re-installation as I had mentioned before and that’s not a path I’d want you to take.

Andriod Build Failure - Programming & Scripting - Epic Developer Community Forums

Already tried that.

Change your NDK API level to 21 or higher for x64. They aren’t included when Android target 19.

Thanks, that solved the problem. :slight_smile:

i have the same problem. however my old version worked with NDK/SDK API 9 UE 4.10 and worked for about 20,000 more devices so I’d like to not change that and find another solution. It worked with my UE 4.10 project and settings. I’m pretty sure it has to do with the installed stuff in the SDK manager but I’m not positive. also i was using windows 7 i think at the time it last worked, but on the same pc.

this is not an acceptable solution for me. it brings my working devices from 23,000 down to only 4,000. and it was working fine before with NDK/SDK API 9

either my project files or my ndk/sdk installation were corrupt. even a blank project would not package. i had to reinstall codeworks and even then this still does not work. in fact, nothing did. so i had to start a new blank project. the settings i found to work on all possible devices was for ndk and sdk ‘matchndk’ for the Android SDK page and on the Android page set both target and minimum sdk to 9. that finally worked. thanks for your patience :slight_smile:

I have the same error packaging new unreal 3rd person cpp project, the steps you propose don’t help

Hello Moonmana,

If you believe that you are experiencing this same issue, due to this being an old issue, please make a new post detailing what you have tried and including your logs from your failed packaging attempt. Feel free to link back to this post as well for context. I would suggest trying 's suggestion of switching your NDK API to 21 if you haven’t, as that is what fixed the original 's issue.

What helped me: I updated codeworks and restarted my computer. i don’t know which of the things helped, maybe both :slight_smile: