stereolabs / zed-unreal-plugin

Stereolabs ZED - UE4 Plugin

Home Page:https://www.stereolabs.com/docs/unreal/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERROR When Build UE4.21 For ZED!

nguyenanhtien2606 opened this issue · comments

Hello,
I'm need work with Zed cam in Ue4, I'm following document in website to install but when build UE4.21-zed version had an error "NDIS_MINIPORT_MAJOR_VERSION' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif". Any help for this.

PS: Version UE4.19-zed work fine but I can't find any version of plugin support this version.

Many thanks!

This is not directly caused by the ZED fork, but instead this is a common problem with Unreal Engine 4.21 when using more up-to-date Windows SDK versions.

In order to fix it, go to the Engine/Saved/UnrealBuildTool/ directory and edit the BuildConfiguration.xml file (create it, if it does not exist). You have to specify the used Windows SDK version explicitly, since Unreal will pick up the latest one automatically. Versions after 10.0.17134.0 do not set the NDIS miniport versions by default. Here's how a fixed build configuration should look like:

<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
     <WindowsPlatform>
         <WindowsSdkVersion>10.0.17134.0</WindowsSdkVersion>
     </WindowsPlatform>
</Configuration>

Make sure you have also installed the Windows SDK v10.0.17134.0. You can do this from the Visual Studio installer. You do, however, also need the MSVC v141 - VS 2017 C++ x64/x86 Buildtools (v14.16) component, since UE4.21 does not (yet) support VS 2019. If you've installed it, you can build using VS2019, though. Note that you still need at least the VS 2017 IDE to be installed in order to be able to create new projects from the UE editor (otherwise the "Create Project" button is disabled - but you do not need VS 2017, if you already have a .uproject file).

You also might run into two additional issues:

  1. Implicit conversion from const wchar_t* to boolean. This is a warning (C4800), which is treated as error. You can silence it by modifying the Engine/Source/Programs/UnrealBuildTool/Platform/Windows/VCToolChain.cs file. Search for Arguments.Add("/TP"); at line 482 and add Arguments.Add("/wd4800"); right below.
  2. Missing typeinfo.h file. This is a breaking change that has been introduced with some MSVC update (iirc). In order to solve the issue, you have to manually patch Engine/Source/ThirdParty/PhysX3/PxShared/src/foundation/include/PsAllocator.h b/Engine/Source/ThirdParty/PhysX3/PxShared/src/foundation/include/PsAllocator.h. Look for the #include <typeinfo.h> line and remove the .h extension.

Finally rerun the setup and project file generation scripts and you should be ready to go. A little bit hacky, but as good as it gets until this fork integrates more recent versions (which I honestly think will not happen - perhaps consider using Unity straight away).

For CI I've solved this issue by creating a patch using git diff, which gets automatically applied. The BuildConfiguration.xml file also automatically gets copied in this case.

That is strange because on my side I could build 4.21.2 with SDK 3.0.3 without errors, at least not the one above. I could buit it with SDK 3.4.2 too, however the video passthrough was showing a black screen (but the camera did turn off and no error was generated). So I downgraded my zed sdk to the 3.0.3 version and then the plugin demos did work properly. fyi

I am on Win10, ZED mini. UE 4.21.2 built from source with ZED SDK 3.0.3.

That is strange because on my side I could build 4.21.2 with SDK 3.0.3 without errors, at least not the one above. I could buit it with SDK 3.4.2 too, however the video passthrough was showing a black screen (but the camera did turn off and no error was generated). So I downgraded my zed sdk to the 3.0.3 version and then the plugin demos did work properly. fyi

I am on Win10, ZED mini. UE 4.21.2 built from source with ZED SDK 3.0.3.

Which one is the latest Windows SDK and Visual Studio version you have installed?

This is not a ZED-specific issue, but rather a general problem with UE 4.21. If you have the Windows SDK version 10.0.16299.0 installed, it may get picked up automatically. This did, however, for some reason not work on one of my test systems. I had to explicitly specify the target Windows SDK version, as described above. I used 10.0.17134.0, which appears to be the latest, UE 4.21 can be built against (at least for me).

The other issues are caused by the missing support for VS 2019 (and breaking changes with the MSVC compiler).

  • The implicit conversion warning got removed from VS2017 at some point before UE 4.21 got released and re-enabled with VS2019. Since warnings are treated as errors when building UE4, a bunch of C4800s are thrown when compiling the fork with VS2019 or more recent MSVC versions installed. This PR fixes this behavior for UE 4.22 or later.
  • The problem regarding the typeinfo header also originates from a breaking change in VS 2019. This PR addresses it.

I don't know if there's any way to force UE to pick up an older compiler. I haven't found one, so my only options were to either uninstall VS 2019 (which I couldn't) or patch those issues manually.

The ZED SDK I have is 3.0.3 (I had to uninstall my 3.4.2 SDK to get the UE4 samples working properly), an I have VS2017 v15.9.34
VS2019 is not supported by unreal engine if I remember well.

thank you this saved my life

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment otherwise it will be automatically closed in 5 days

@crud89 Thanks for detailed answer, but this error seems to be occurred again when targeting for latest windows sdk 10.0.22621.0, any new advices for 4.27.12 version? thanks.

Unfortunately not. UE appears to be not that flexible in terms of plug-ins and requires custom engine builds, like this one. You are limited to using version 4.21 because of this.

I myself switched to Unity for newer projects because of this.

`Cheers @crud89