IL2CPP build problem

Just posting this here instead of bumping the thread in archive . I got this problem during IL2CPP build:

Cannot open include file: 'string.h': No such file or directory

Could it be made more obvious that the C++ Workload needs to be installed? Or would it be possible to have it installed implicitly? Without the thread above I wouldn’t have had any idea that I’d need to install that. I didn’t find anything about it in the documentaiton either.

Unfortunately we don’t have a great way to detect this case. The C++ compiler is installed - that we can detect and error properly if it is not installed - but part of the SDK is missing here. So we don’t have many better error message options.

Maybe adding common pitfalls to the documentation here could help as well?

https://docs.unity3d.com/Manual/IL2CPP.html

That forum thread will be deleted. So permanent information could be very helpful.

2 Likes

Yes, that might not be a bad idea.

We’ve been discussing this issue at bit here, and if you are willing, we would love some help understanding what state the Visual Studio and C++ workloads are in on your computer. That might help us better detect this issue.

For example, do you have a string.h file some where around this path?

“C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\string.h”

Of course, if you have installed the Windows 10 SDK already, then maybe things are working now and we can’t gather more information about your configuration. But I wanted to ask anyway.

No, the file wan’t there. I already fixed it by installing the C++ workload, so can’t give you any more details unfortunately. But here’s what I did when I installed VS2019:

  • had VS2017, uninstalled it
  • installed VS2019
  • added some .NET versions
  • added Unity Hub

I didn’t install anything C++ related. I was under the impression I wouldn’t have to because Unity would have everything it needs. I’m noob in that regard.

What I notice now is that the Unity stuff isn’t installed, it isn’t ticked, i. e. “Spieleentwicklung mit Unity”. I was under the impression that I did that. I could debug after all.

Unfortunately my VS2019 installer is german and I have no idea how to change that, I’d very much like to. Anyway, these are the settings I have now:


I ticked “Desktopentwicklung mit C++”, after that and the implicit installation everything worked and the IL2CPP compilation was successful. These are the details of my now working installation in case it helps:


1 Like

Thanks for all of these details. I’ll open a bug report internally to track this. We should improve the error message when this Visual Studio installation workflow happens.

2 Likes

Here is a link to the bug report: Unity Issue Tracker - Poor error message from IL2CPP on Windows Desktop with specific Visual Studio installation sequence (Note that it might not appear there for a little while, I’m not sure how long it takes to sync with our internal bug tracking tool).

2 Likes

I think what happened was that uninstalling VS2017 left some things behind. Unity found those things and assumed Windows SDK was already installed (by checking only registry keys and not the existence of actual files) so it went through our normal SDK checks just fine. And then we launched the compiler, and it led to you getting that error.

We’ll fix it.

2 Likes

Are there any news regarding this issue? I get exactly the same error after updating from vs17 to vs19. I even uninstalled visual studio, and unity completetly, installed both from the hub and still get this error. After that I manually added all the packages shown in the image above, still getting the error, this is so frustrating, doing nothing but uninstalling/installing packages a whole day, not being able to fix this error.

The mentioned path above:
“C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\string.h”
is available, but Unity doesn’t seem to be able to find it there?!

Is there some cache folder to delete to clear the mentioned leftovers, which wasn’t cleared when uninstalling vs/unity in appdata or sth, which I could try to clear?

Edit: Turned out that Unity2021.9.f1 isn’t looking for 10.0.18362.0, but for 10.0.20348.0, which wasn’t installed with VS19 when installing together with the editor (at least not when it was uninstalled before it seems), also many there weren’t installed like the workload package aswell as the Windows Universal C-Runtime. Maybe it helps fixing the issue.

We have vastly improved installation detection and error messages in Unity 2021.2. If you haven’t fixed your issue yet, you might want to give the 2021.2 beta a shot to see if it behaves better.

1 Like

It works now the version mismatch was causing my issue, but thanks for the notice, sounds great for VS updates in the future :slight_smile:

This problem disappeared when I installed the C++ Desktop Development Kit

hey bro, what issue did you faced here ?
Actually i am building an android game and play store
needs 64bit support that il2cpp provides
but my game is crashing after 9-10 minutes of play