pixeltris / USharp

C# plugin for Unreal Engine 4
MIT License
411 stars 67 forks source link

Issues Compiling USharp and Module Generation Errors #67

Closed Tanner555 closed 5 years ago

Tanner555 commented 5 years ago

With the new commit, I'm having trouble compiling USharp with Unreal Engine 4.22. When I compile the c plus plus, I get this error.

 C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_IPluginManager.h(55): error C4800: Implicit conversion from 'csbool' to bool. Possible information loss C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_IPluginManager.h(55): note: consider using explicit cast or comparison to 0 to avoid this warning C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\ExportedFunctionsConventions.h(96): note: see declaration of 'csbool' C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FTickFunction.h(63): error C4800: Implicit conversion from 'csbool' to bool. Possible information loss C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FTickFunction.h(63): note: consider using explicit cast or comparison to 0 to avoid this warning C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\ExportedFunctionsConventions.h(96): note: see declaration of 'csbool' C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FGlobals.h(148): error C4800: Implicit conversion from 'csbool' to bool. Possible information loss C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FGlobals.h(148): note: consider using explicit cast or comparison to 0 to avoid this warning C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\ExportedFunctionsConventions.h(96): note: see declaration of 'csbool' C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FMemory.h(120): error C4800: Implicit conversion from 'const csbool' to bool. Possible information loss C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FMemory.h(120): note: consider using explicit cast or comparison to 0 to avoid this warning C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\ExportedFunctionsConventions.h(96): note: see declaration of 'csbool' C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FMemory.h(125): error C4800: Implicit conversion from 'csbool' to bool. Possible information loss C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FMemory.h(125): note: consider using explicit cast or comparison to 0 to avoid this warning C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\ExportedFunctionsConventions.h(96): note: see declaration of 'csbool' C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FSlowTask.h(3): error C4800: Implicit conversion from 'csbool' to bool. Possible information loss C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FSlowTask.h(3): note: consider using explicit cast or comparison to 0 to avoid this warning C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\ExportedFunctionsConventions.h(96): note: see declaration of 'csbool' C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FSlowTask.h(8): error C4800: Implicit conversion from 'csbool' to bool. Possible information loss C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\Exporte

Just like I noted in my old 4.22 upgrade PR https://github.com/pixeltris/USharp/pull/66, I had to add explicit casts to every export method with csbool parameters. When I did this, I was able to compile USharp just fine and load up a new UE4.22 project with it installed.

But there's another issue. When I try generating the modules (USharpGen modules), the generated code has a bunch of errors. Most of them are ambiguous reference errors.

1>------ Build started: Project: UnrealEngine, Configuration: Debug Any CPU ------ 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(722,21,722,45): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_IsValid' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(723,16,723,56): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_InstanceFunctionAddress' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(724,23,724,55): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_FunctionAddress' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(725,20,725,47): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_ParamsSize' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(726,21,726,57): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_NewMeshInfo_IsValid' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(727,30,727,74): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_NewMeshInfo_PropertyAddress' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(728,20,728,55): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_NewMeshInfo_Offset' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(729,21,729,59): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_RequestedMesh_IsValid' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(730,30,730,76): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_RequestedMesh_PropertyAddress' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(731,20,731,57): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_RequestedMesh_Offset' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(736,21,736,37): error CS0111: Type 'UMeshTrackerComponent' already defines a member called 'SelectMeshBlocks' with the same parameter types 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(767,24,767,55): error CS0111: Type 'UMeshTrackerComponent' already defines a member called 'SelectMeshBlocks_Implementation' with the same parameter types 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Engine\FunctionalTesting\TraceQueryTestResults.cs(128,23,128,31): warning CS0114: 'UTraceQueryTestResults.ToString()' hides inherited member 'object.ToString()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Engine\Engine\KismetSystemLibrary.cs(4548,30,4548,41): warning CS0108: 'USystemLibrary.GetPathName(UObject)' hides inherited member 'UObject.GetPathName(UObject)'. Use the new keyword if hiding was intended. 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Engine\Engine\KismetSystemLibrary.cs(7115,28,7115,42): warning CS0108: 'USystemLibrary.C

And a funny example of a UEnum that is an EEnum instead for whatever reason.

UnrealEngine.Runtime.UEnum toReturn = UObjectMarshaler<EEnum>.FromNative(IntPtr.Add(ParamsBuffer, GetAnimationStateEnum_ReturnValue_Offset), 0, GetAnimationStateEnum_ReturnValue_PropertyAddress.Address);
Tanner555 commented 5 years ago

Issues are fixed in new commits https://github.com/pixeltris/USharp/commit/cbfa507edbee99330cbab023857fa943f9830375