Search Unity

(Solved) Can't build Windows IL2CPP project

Discussion in 'Windows' started by Mikhail94, Mar 24, 2020.

  1. Mikhail94

    Mikhail94

    Joined:
    Dec 22, 2015
    Posts:
    35
    I get an error



    Code (CSharp):
    1.  
    2. il2cpp.exe didn't catch exception: System.InvalidOperationException: C++ code builder is unable to build C++ code. In order to build C++ code for Windows Desktop, you must have one of these installed:
    3.        Visual Studio 2015 with C++ compilers and Windows 10 SDK (it cannot build C++ code because it is not installed)
    4.        Visual Studio 2015 installation is found by looking at "SOFTWARE\Microsoft\VisualStudio\14.0_Config\InstallDir" in the registry
    5.        Windows 10 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry
    6.        Visual Studio 2017 with C++ compilers and Windows 10 SDK (it cannot build C++ code because it is not installed)
    7.        Visual Studio 2017 installation is found using Microsoft.VisualStudio.Setup.Configuration COM APIs
    8.        Windows 10 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry
    9.  
    What did I miss to install in VS?



    Unity 2019.3.3f1
    Visual Studio 2019 16.5.0
    Windows 10 x64 1909 18363.720
     
    FlightOfOne likes this.
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    You need to install C++ related components into your Visual Studio. I can't read the screenshot you posted but on the English version of the installer it's called "Desktop development with C++":
    upload_2020-3-24_11-13-54.png
     
  3. Mikhail94

    Mikhail94

    Joined:
    Dec 22, 2015
    Posts:
    35
    @Tautvydas-Zilys Thanks! My mistake was that I tried to manually add the necessary components (C++ build tools and Win 10 SDK).

    To make it work, need to install "Desktop development with C++" with all default packages (installing only base components and Win 10 SDK is not enough).

    Аннотация 2020-03-25 083750.png
     
  4. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    @Tautvydas-Zilys can you clarify which version of the Windows 10 SDK needs to be installed for Unity 2019.3.15f1?
    I have 10.0.18362 installed but still get exceptions when trying to build to IL2CPP that I didn't get in earlier Unity versions with the same project.
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    What kind of exceptions? That SDK version should work.
     
  6. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    "assert.h not found".
    Installing all available Windows 10 SDKs (there's 4 installed now) fixed the issue.
    I'll see if I find the complete error message again if that's unexpected.

    EDIT: After uninstalling all but the latest Windows 10 SDK (so, bringing it back to the state it was before) the error doesn't happen anymore. So, just the usual Unity glitch that takes a couple of hours to find and fix just to not be reproducable ;)
     
    Last edited: Jun 11, 2020
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Generally assert.h not found error message happens when Windows SDK isn't installed properly.. I've seen it before :(.
     
  8. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    Me too, but in this case the only thing I did to resolve it was to install 3 additional SDKs and uninstall them again. The 1st one (latest version) wasn't changed at all! So weird.
     
  9. snowysnowy

    snowysnowy

    Joined:
    Jun 1, 2020
    Posts:
    2
    Question, why can't we just simply modify this in Unity Hub?
     
  10. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,665
    It's part of Visual Studio, not Unity.
     
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    You actually can. Unity Hub does offer you to install Visual Studio if you opt into it.
     
  12. Zarkow

    Zarkow

    Joined:
    Jul 27, 2015
    Posts:
    92
    For anyone else looking to find where to download this, open VS, Tools -> Get Tools and Features
     
  13. Satindar

    Satindar

    Joined:
    Sep 11, 2020
    Posts:
    14
    I think you can get it from the installer, right?